I am currently using a formula to calculate a variable, which looks like:
=(Fields!MontantInitialRegime.Value/Fields!MontantInitial.Value)*Fields!SoldeFacture.Value
It works well, except for the cases where both numerator and denominator equal zero.
I've done some research and I've tried to solve it by using the formula below, which doesn't work.
=IIF(Fields!MontantInitialRegime.Value = 0, Fields!SoldeFacture.Value, Fields!MontantInitialRegime.Value /
IIF(Fields!MontantInitial.Value = 0, Fields!SoldeJour.Value, (Fields!MontantInitialRegime.Value/Fields!MontantInitial.Value)*Fields!SoldeFacture.Value))
Please note that if the result of the division is an error, I'd like to show Fields!SoldeFacture.Value
.
Here's an example of the current output: