开发者

Adding row content in report viewer

开发者 https://www.devze.com 2023-03-16 03:13 出处:网络
So i have this report viewer - i have a table which contains my data based on my stored procedure. i have 5 rows in my report each line containing a certain number - i have a totals line which should

So i have this report viewer - i have a table which contains my data based on my stored procedure. i have 5 rows in my report each line containing a certain number - i have a totals line which should calculate the total amount based on the above line amounts like so :

line 1 : 20 line 2 : 4 line 3 : 12 line 4 : 1 line 5 开发者_C百科: 10 Totals : 47

I tried the expression:

=Sum(Fields!TotalResults.Value) 

But i get a much greater number which seems to be counting for none showing lines. How can i get the total for just the showing lines?


If you're choosing to display only certain rows based on an expression, you can use this same expression in your calculation.

For example, let's say you have a Visibility expression on the row that looks like this ("display the field only if XYZ is greater than 3"):

=iif(Fields!XYZ.Value>3, true, false)

Adapt your Sum aggregate to include the conditional, like this ("Sum only the values of TotalResults where XYZ is greater than 3"):

=Sum(iif(Fields!XYZ.Value>3, 0, Fields!TotalResults.Value))

Replace Fields!XYZ.Value>3 with your own visibility condition, of course.

If this doesn't solve your problem, give us some more information about how you're determining which rows to display and maybe that will help. :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号