Search code examples
rdlcdynamic-rdlc-generation

RDLC expression error


Hopefully I might have the easiest question to answer but so far I couldn't figure it out. I have a RDLC report with following expression.

    =Iif(Sum(Fields!OriginalTotal.Value) = 0, 0, (Sum(Fields!WorkingTotal.Value) - Sum(Fields!OriginalTotal.Value))/Sum(Fields!OriginalTotal.Value)) 

Please note that this field on the report is formatted as percentage with two decimal places.

Problem is whenever the Sum(Fields!OriginalTotal.Value) = 0 condition is true, field prints as "#Error" on the report.

What am I doing wrong here?

Thanks in Advance!


Solution

  • There is a well known problem that ssrs calculates both expressions of "iif". That's why you get Error when trying to divide on 0.

    Have a look at the following links: