Hi,
In the BI developement, in a matrix i'm trying to avoid division by zero, but even if i test the field before the division, i've got the error everytime.
I put the folowing test condition in the field, but i've got an error.
Ex : iif(Turnover <> 0, Cost/Turnover,0)
But i've got error message when the turnover is 0.
Thanks for your help.
In an iif statement, both results are evalualted regardless on which is chosen by the conditional statement. So Cost/Turnover is being evaluated even if turnover is 0.
I believe you could do a statement like: =switch(Turnover<>0,Cost/Turnover,Turnover=0,0)
|||I have taken this approach with my zero checks:
=IIf(
Fields!Turnover.Value > 0,
FormatNumber(
Fields!Cost.Value / Fields!Turnover.Value ,
2,
true,
false,
false
),
"0"
)
Because the FormatNumber returns a string and swallows the divide by zero this works nicely.
No comments:
Post a Comment