I have two decimal fields, profit and income. They appear in the tablix control, each of which has its own column. In the third column, I want to divide earnings by income. The result, when any of these fields is zero, is #error, I assume this is due to division by zero. To solve this problem, I came up with the following expression:
=iif(Cint(Fields!revenue.Value) = 0 orelse cint(Fields!profit.Value) = 0 ,"",FormatPercent(Fields!profit.Value / Fields!revenue.Value,2))
This expression still leads to #error. I did some testing and took out the false part of the expression. The expression looked like this:
=iif(Cint(Fields!revenue.Value) = 0 orelse cint(Fields!profit.Value) = 0 ,"No","Divide")
When running this expression, the C # error source points now show "No." This tells me that the expression works as I expected, but why does it throw #error when adding a division to a false state. He must not beat this part of the expression. Any help is appreciated. I also tried the switch statement, but the results were the same. He threw #error anytime I had a division in an expression.
source
share