Friday, September 26, 2008

Expression to Change NaN values to 0 in SSRS

When we use calculation in generating reports, we get "NaN" value in preview , If we wanted to avoid this and display Zero if the result of calculation is null or infinity..

I used the below calculation

I have two Fields. One is 'First' and another is 'Second'. Now i want to divide these two Field values and show it in SSRS Report. If both the values are zero then it will show as 'NaN' while previewing the Report. To Overcome this use the following expressing

=IIF(ISNOTHING(Fields!Second.Value), 0, IIF(Fields!Second.Value=0, 0, Fields!First.Value/Fields!Second.Value))

No comments: