i need to change those NAN values to 0 in ssrs report
When I use calculation in generating reports, I get "NaN" value in preview , I wanted to avoid this and display "0" if the result of calculation is null or infinity.. I used the below calculation =CDbl(Fields!POST_TEST_COUNT.Value/Fields!ENROLL_Actual.Value), here i taken input as percentage for every field. Please let me know how to avoid "NaN" and "infinity", while displaying in reports when ever i see the prview NAN values are displayedand remaining fields are shows appropriate query results like percentage valuesLike 98%.00 some thing but i have a problem with NAN values i need to change those NAN values to 0 plese help me.
December 2nd, 2007 2:15pm

Try this =IIF(ISNOTHING(Fields!ENROLL_Actual.Value), 0, IIF(Fields!ENROLL_Actual.Value=0, 0, Fields!POST_TEST_COUNT.Value/Fields!ENROLL_Actual.Value))
Free Windows Admin Tool Kit Click here and download it now
December 3rd, 2007 2:42am

WITH MEMBER [Measures].[NullValuePerUnit] AS Null MEMBER [Measures].[ZeroValuePerUnit] AS 0 MEMBER [MEMBER_NAME] AS ( iif([Measures].[MEASURE_VALUE_DENOM]=0 OR ISEMPTY([Measures].[MEASURE_VALUE_DENOM]),[Measures].[NullValuePerUnit], [Measures].[MEASURE_VALUE_NUMER]/[Measures].[MEASURE_VALUE_DENOM]) )This handles both theNAN(When x/0) and INFINITY(when x/null).I had to create the MEMBER[Measures].[NullValuePerUnit] because by having NULL/0 in the query directly, i shows as #error in the subtotal. If subtotal is not there then it works fine without having to create the NULL measure.Also if you happen to code asMeasures].[MEASURE_VALUE_DENOM]=NULL, then it is completely wrongvinu
February 20th, 2009 8:19am

WITH MEMBER [Measures].[NullValuePerUnit] AS Null MEMBER [Measures].[ZeroValuePerUnit] AS 0 MEMBER [MEMBER_NAME] AS ( iif([Measures].[MEASURE_VALUE_DENOM]=0 OR ISEMPTY([Measures].[MEASURE_VALUE_DENOM]),[Measures].[NullValuePerUnit], [Measures].[MEASURE_VALUE_NUMER]/[Measures].[MEASURE_VALUE_DENOM]) )This handles both theNAN(When x/0) and INFINITY(when x/null).I had to create the MEMBER[Measures].[NullValuePerUnit] because by having NULL/0 in the query directly, i shows as #error in the subtotal. If subtotal is not there then it works fine without having to create the NULL measure.Also if you happen to code asMeasures].[MEASURE_VALUE_DENOM]=NULL, then it is completely wrongvinu
Free Windows Admin Tool Kit Click here and download it now
February 20th, 2009 8:19am

Its very simple,In SSRS reports...go to the particular column that you are facing thisNaN error...and replace the expression with the code below....alter the code according to your column names and summations. check the bold ones.=replace(round(((Sum(Fields!ROLLBACKWARD.Value)/Sum(Fields!TOTAL.Value))*100),2),"NaN","0")+"%"for any other clarifications mail me.Regards, Arun R S Mobile: 91.0.9840525125 Direct: 044-66342000E-mail: arunrs@choladbs.murugappa.comBlog : http://arunlegend.blogspot.comROAD GAMER
February 20th, 2009 9:47am

Thanks Arun...this worked for me...
Free Windows Admin Tool Kit Click here and download it now
December 30th, 2009 9:18pm

I understand this question was from long back, but posting a solution, so that might some one in need. When I use calculation in generating reports, I get "NaN" value in preview , I wanted to avoid this and display "0" if the result of calculation is null or infinity.. Something like this might also help. IIF((Fields!POST_TEST_COUNT.Value/Fields!ENROLL_Actual.Value).IsNaN(Fields!POST_TEST_COUNT.Value/Fields!ENROLL_Actual.Value) or (Fields!POST_TEST_COUNT.Value/Fields!ENROLL_Actual.Value).IsInfinity(Fields!POST_TEST_COUNT.Value/Fields!ENROLL_Actual.Value),0,(Fields!POST_TEST_COUNT.Value/Fields!ENROLL_Actual.Value))
January 28th, 2011 12:58am

(Fields!POST_TEST_COUNT.Value/Fields!ENROLL_Actual.Value).IsNaN(Fields!POST_TEST_COUNT.Value/Fields!ENROLL_Actual.Value) or (Fields!POST_TEST_COUNT.Value/Fields!ENROLL_Actual.Value).IsInfinity(Fields!POST_TEST_COUNT.Value/Fields!ENROLL_Actual.Value) Hi Devi B I undersstand the method above is very interesting. Could you please explain how IsNan is differenct from IsInfinity? I know that Nan stands from not a number but in terms of usage how is it different? Thank you
Free Windows Admin Tool Kit Click here and download it now
July 13th, 2011 7:07am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics