IIF fails on simple equation

CodeViperCodeViper Member Posts: 28
I have an IIF that looks like it is evaluating the full equation instead of acting on the first 'TRUE' part of the statement.

I have the following code in a cell on a report.

If their are NoTurns of Inventory, place a zero in the box. (Currently it shows ERR# when the value is zero).
And if there ARE NoTurns in Inventory, do the math calculation... which it does fine...

What am I missing??
This is the code I am using... I split it out to 4 lines just so I could visualize the layout/condition.

CODE START
=IIF( SUM(Fields!NoOfTurns.Value) = 0
, 0
, ((Sum(Fields!Item__Sales__Qty___.Value) + Sum(Fields!Item__Negative_Adjmt___Qty___.Value)) / Sum(Fields!AverageInventory.Value))
)
CODE END

I have tried using SWITCH, same issue. "=SWITCH(sum(Fields!NoOfTurns.Value) = 0, 0, sum(fields!NoOfTurns.Value > 0, *above equation*)

Shouldn't be rocket science to say "If your zero, print a zero"...

Any insight on how to fix this would be greatly appreciated... hate having a report show ERROR when I nice zero will do... :)

ADS

Answers

Sign In or Register to comment.