How expert, I have a dataset X in the RDLC report, which has expression as (sum A/sum
*100.
But when A is equal or less than zero, X will be showing ERROR since it is divided by zero exception. How to add the if condition to the dataset X to avoid the error? Thank you!
Comments
=IIF((Sum(Fields!TL1.Value)-Sum(Fields!TL2.Value))=0,0,sum(fields!Mship1.Value)-sum(Fields!Mship2.Value))/(Sum(Fields!TL1.Value)-Sum(Fields!TL2.Value))*100)
I tried again using the following expression for the textbox control
=IIf(Sum(Fields!TS.Value)=0,0,Sum(Fields!MS.Value)/Sum(Fields!TS.Value)*100)
It is the same result. For those TS that are not zero, the numbers are correct, but if the TS is zero, it stil shows error.
Please advise, expert! Thank you!
Try this and let me know
Make Sure checking both value in divide calculation, try this and hope it works
=IIF(SUM(Fields!TS.Value) = 0,0,IIF(SUM(Fields!MS.Value)=0,0,(SUM(Fields!MS.Value)/SUM(Fields!TS.Value))*100)))
I tested both. geordie's code is working now. Thank you very much!
william_marcelinus's code seems like the error will not go away.
Thank you for both experts!