Why isn't this expression for a ReportViewer field field working?

658 Views Asked by At

I have a calculated field in one of my reports:

=IIf(Fields!Log_Total.Value > 0, (Fields!Log_Cost.Value + Fields!Labor_Cost.Value + Fields!Part_Cost.Value + Fields!Other_Costs.Value) / Fields!Log_Total.Value, 0)

As far as everything I have seen this is the correct syntax for what I am trying to accomplish, which is basically, check for zero, if not zero, add these and divide by this. When I run the report the field just comes out as #ERR. All the fields above are a part of the dataset, which I know is working fine. Please help

1

There are 1 best solutions below

6
On

The expression itself seems to be fine. Otherwise you'd be getting an error right away when launchung the report.

Do one or more fields in the sum have the value null in the data source? In that case, the sum might not work.

Are you sure all the values actually have numeric types? Make sure that none of them is returned as a string or something from the database.