SSRS IIF Statement

This should work but it doesn’t. It gives me a blank value for the text box. Fields!SalesBundle.Value is false in my example.

=iif(Fields!SalesBundle.Value = true, FormatNumber(Fields!TotalBundleDocUnitPrice.Value, 2), FormatNumber(Fields!DocUnitPrice.Value, First(Fields!DecimalsPrice.Value, "RptParameter")))

This does work and outputs the correct DocUnitPrice of the line (the false condition).

=iif(Fields!SalesBundle.Value = true, "123.00", FormatNumber(Fields!DocUnitPrice.Value, First(Fields!DecimalsPrice.Value, "RptParameter")))

Bah. That field didn’t exist in my SSRS dataset. I could’ve SWORE I grabbed the fields I needed in my SELECT statement… I know I did in fact… I must not have hit OK when I was done editing. But yeah troubleshooting 101… so if you find yourself not getting errors but the output is not expected, double check and make sure you selected the field in your SQL query. I didn’t get an error because I created the field in the fields section… just didn’t fill it with anything from my SQL.

1 Like