Sunday, February 19, 2012

iif error in reporting services

Hi ,

Is there anything wrong in the below expression?

=IIf(Fields!outboundcalls.Value=0,"0.00%",(Sum(Fields!obappt.Value))/(Sum(Fields!outboundcalls.Value)))

I have the above expression in a grouping row.

sometimes even when 'Fields!outboundcalls.Value' is not equal to zero it is still displaying "0.00%" in the report.it does this randomly.it works fine in some rows and in some it displays "0.00%".

I find it odd because i have defined the same expression for all rows, yet it works only for some...

can anybody shed some light on this issue if i am missing anything?

Thanks!

The problem is that with IIF, both the true and false "parts" get executed no matter how the expression evaluates. Try using Switch instead. Something like this:

=Switch(Fields!outboundcalls.Value = 0,"0.00%", Fields!outboundcalls.Value <> 0, DO DIVISION HERE )

No comments:

Post a Comment