Reporting Services expression fails in some circumstances

I get an error when calculating the average values ​​in the report summary line. My expression is as follows:

=IIF(SUM(Fields!column3.Value) > 0, Format(DateAdd("s", (SUM(Fields!column4.Value) / SUM(Fields!column3.Value)), "00:00:00"), "HH:mm:ss"), "-")

(sorry for the super long string)

The expression works fine when the data looks something like this:

8311    87  0   0
8311    41  0   0
8311    80  0   0
8311    136   1   136

The idea is that column 3 is column 1 if column 2 is 120, otherwise it is 0. Column 4 has a value greater than 0 only if column 2 is greater than 120, in which case it is the same value as column 2 Thus, for the summary row of this group in Reporting Services, I can determine the total number of rows that are greater than 120 (using the SUM in column 3). Similarly, I can determine the total number of values ​​in column 2 that exceed 120 by summing column 4. From there, it should be a simple division of column 4 by column 3 to determine the average value of column 2 with values ​​in excess of 120.

As soon as I get the average, I want to convert it to a time string (for example, "00:02:16"). If there is no value (that is, the value of column 2 is greater than 120 in the group, I want to display "-".

, 2 120. , 3 4 0, :

8310    108 0   0

#Error . , , IIF , , > 0.

, #Error , 0 3 4. ?

+2
1

iif SSRS Visual Basic IIF: , - , .

:

  • ,
  • IIF, .

: :

=IIF(SUM(Fields!column3.Value) > 0, Format(DateAdd("s", (SUM(Fields!column4.Value) / SUM(Fields!column3.Value)), "00:00:00"), "HH:mm:ss"), "-")

=IIF(SUM(Fields!column3.Value) > 0, Format(DateAdd("s", (SUM(Fields!column4.Value) / IIF(SUM(Fields!column3.Value)>0,SUM(Fields!column3.Value),1)), "00:00:00"), "HH:mm:ss"), "-")

( , ...)

. http://social.msdn.microsoft.com/Forums/is/sqlreportingservices/thread/b8e0730b-da60-49a8-8613-2309ff1a2c90

+4

All Articles