Report Builder Divided by Zero Error

Has anyone else encountered this error? Even when I use the IIF statement to return 0, the error still persists.

=IIf(Fields!B.Value = 0, 0, Fields!A.Value / Fields!B.Value)

Thank you!

You need to evaluate for null values.
Try, I think.
=IIf(isNull(Fields!B.Value), 0, Fields!A.Value / Fields!B.Value)

I’ve tried that as well, but the error still persists.

I think this is a known issue in SSRS. It evaluates both sides of the if, even when the first condition is false. Trying using Nullif(Fields!B.Value,0) as your denominator, or replacing the null in your dataset query.

The dataset uses 0 for null values, but I’m still having an issue.

=IIF(ISNothing(SUM(Fields!A.Value)) OR SUM(Fields!A.Value) = 0, 0,
IIF(ISNothing(SUM(Fields!B.Value)) OR SUM(Fields!B.Value) = 0, 0,
SUM(Fields!A.Value) / SUM(Fields!B.Value)))

It was a while ago, but I’ve always done (if x > 0, y / x, 0) and not gotten errors.

I’m still getting an error. I think the issue might be with the report builder.