GabrielVa
GabrielVa

Reputation: 2388

NaN SSRS Expression Fix

I'm working on a SSRS report and I keep getting a NaN value when I'm doing a divide here. How can I replace the NaN with 0 in my statement?

=Fields!Whse_QTY.Value/Fields!Total_QTY_Sales.Value

Upvotes: 0

Views: 3989

Answers (1)

Ian Preston
Ian Preston

Reputation: 39586

You need to be careful due to the lack of short circuiting in the IIf statement.

Something like:

=IIf(Fields!Total_QTY_Sales.Value = 0, 0, Fields!Whse_QTY.Value)
  / IIf(Fields!Total_QTY_Sales.Value = 0, 1, Fields!Total_QTY_Sales.Value)

should do the job.

Upvotes: 1

Related Questions