I have a field where i have to do a division. To be sure that the value will never be zero i have done this:
=IIf(Sum(Fields!Total_Amount_1.Value) <>0,
((Sum(Fields!Total_Amount_2.Value)-Sum(Fields!Total_Amount_1.Value)) / Abs(Sum(Fields!Total_Amount_1.Value))),"N/A")
When i run the report i get the "#Error" in the field.
I have done some test and notice that it seems that the problem is that the IIF try both condition (true condition and false condition). When i replace the ABS function by a number like 100 everything is working fine. So the error seems to be the division by zero but this is why i'm using a IIF.
How can i do this division only if the value is not 0 and when it's 0 return "N/A" ?
Thank !
I found a post with the same question as mine:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=188595&SiteID=1
This work fine!
Thanks
No comments:
Post a Comment