Hi All, hope someone can help me with this. I have SSRS 2008 and using BIDS 2005 to write a report. I have a report that I'm calculating a column. The calculation is (InvoicedAmount - Total Costs)/InvoicedAmount. Sometimes InvoicedAmount = $0. In those cases, my column was returning #Error because it was trying to divide by 0. So, I tried both expressions below and neither work. When entering the expression, neither show a syntax error and the report will run, but the column will show #Error and the output shows "The Value expression for the textbox 'Margin' contains an error: attempted to divide by zero." If InvoicedAmount is $0, I want to display $0, otherwise I want to run the calculation. What am I doing wrong?
=IIF(Fields!InvoicedAmount.Value=0,Fields!InvoicedAmount.Value,
((Fields!InvoicedAmount.Value-Fields!TotalCosts.Value)/Fields!InvoicedAmount.Value))
OR
=SWITCH(Fields!InvoicedAmount.Value=0,Fields!InvoicedAmount.Value,Fields!InvoicedAmount.Value>0,
((Fields!InvoicedAmount.Value-Fields!TotalCosts.Value)/Fields!InvoicedAmount.Value))
Milissa Hartwell