Infinity / Nan / #Error in SSRS 2005 Reports

  • Howdy all,

    So I am new to the SSRS. Bought a book and started to go.

    So far its been a walk in the park (with a lot of muggers).

    Now I am stuck on this one problem. When I compute percents for my report, sometimes there are no sales for an area and I am getting NAN or #error or Infinity.

    What I would like to do is show a 0 in that field instead.

    The issue is that sometimes I am doing this on 4 fields (A_Rev_TY/B_Rev_TY) / (A_Rev_LY/B_Rev_LY)-1.

    I don't really want to put 4 nested IIF's into the box, for my 56 boxs where I would need them.

    Is there no way to say Don't show these errors or something I am missing?

    Any Ideas?

    Doug

  • in my case, i do all my calculations in the SQL, instead of in the report....

    so my SQL would have one more field, that has this for the calculation:

    (A_Rev_TY/B_Rev_TY) / (A_Rev_LY/B_Rev_LY)-1.

    CASE

    WHEN ISNULL(B_Rev_TY,0.0) = 0

    THEN 0 --no need to calc the second part of the equation...zero divided by anything is still zero

    ELSE

    --another, inner case:

    CASE

    WHEN ISNULL(B_Rev_LY,0.0) = 0

    THEN 0

    ELSE (A_Rev_TY/B_Rev_TY) / (A_Rev_LY/B_Rev_LY)

    END

    END

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Thanks for that. That is a good idea and I will keep it in mind.

    Not to go into too much detail, but my report gives 4 cuts of the same data. So its sorted by Month / Offices / Department&Owner / Product / Corporate Customer.

    There is just no way to do all the calcs in the SQL (As you can't sum or average the percents)

    So can I take it then there is no easy OnError Display 0.

    🙁

    Doug

  • Am not saying I *like* this (due to having to 'hook' the IsNaN function to the equation, doesn't appear to allow it to stand alone) but it works....

    =Iif((Fields!field1.Value / Fields!field2.Value).IsNaN(Fields!field1.Value / Fields!field2.Value), 0, Fields!field1.Value / Fields!field2.Value)

    so psuedo-code... if A / B is NaN then 0 else A / B

    HTH,

    Steve.

  • This works ! .. Thanks 🙂

  • Very Helpful..... Thank you....:-)

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply