Crystal expression help please
Can someone help me ... converting this to a SSRS expression?
if round({CARBON},0) = 0 then 0 else
(round({CARBON4},0)/round({CARBON},0)) * 100 FM
May 2nd, 2011 3:28pm
Farhan,
You can use a combination of the IIF and CLng functions. e.g.
=IIF(CLng(Fields!Carbon.Value)=0, 0, CLng(Fields!Carbon4.Value) / CLng(Fields!Carbon.Value) * 100)
However, I am unclear why you are wanting to round the values to 0 decimal places. e.g. If Carbon is 0.4 and Carbon4 is 0.3, do you really want to return 0 instead of 75?
The above expression should give an equivalent result to the Crystal expression. However, you may want to consider using just this one:
=IIF(Fields!Carbon.Value=0, 0.0, Fields!Carbon4.Value / Fields!Carbon.Value * 100)
It's possible it may reduce some false negatives in your report.
Note: you could also remove the * 100 and format the cell as %.
Thanks.
Malcolm Stewart
Free Windows Admin Tool Kit Click here and download it now
May 2nd, 2011 3:53pm