简体   繁体   中英

How do I set 1st row value from sql in ssrs report?

I'm working on SSRS report.

There are two main fields CurrentMV and PreviousMV both are having there different formulas but I'm taking PreviousMV as a value of CurrentMV using =Previous(Sum(Fields!CurrentMV.Value))

Now How can I set 1st field only from sql and rest of other as it is coming from expression?

Because of I'm using Previous function 1st value is always coming null :(

I have the field in reporting proc which can give me the values but How can I set both 1st values as well as Previous function ?

在此处输入图片说明

Using Ian posts in answer But , I want to display only 1st field from Sum(Fields!PreviousMV.Value) and all preceding values by using Previous(Sum(Fields!CurrentMV.Value))

I tried like following and getting syntax error:

=First(Sum(Fields!PreviousMV.Value)) ,Previous(Sum(Fields!CurrentMV.Value)) 

You can explicitly check for NULL values:

=IIf(IsNothing(Previous(Sum(Fields!CurrentMV.Value)))
    , Sum(Fields!PreviousMV.Value)
    , Previous(Sum(Fields!CurrentMV.Value)))

Since there are no Previous groups for the first group, this will return NULL for the first group, and hence the above expression will work for you.

Here is a simple report that uses the expression.

Data:

在此处输入图片说明

Report:

在此处输入图片说明

The expression value is the one above.

Result:

在此处输入图片说明

You can see it's picking up the values as intended.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM