views:

19

answers:

1

Hello All, when I run the SSRS report with the following expression below, I get an error that says: wrong number of arguments. I get this error at the ).IsNaN, part of my statement. I don't see what i'm missing. Can anyone please help?

=iif(

        (

              (


                    (Sum(Fields!UNITS.Value, "SFY2011_SW_T19") / Sum(Fields!DISTINCT_CLIENT_PAY.Value, "SFY2011_SW_T19"))

                    - (Sum(Fields!UNITS.Value, "SFY2010_SW_T19") / Sum(Fields!DISTINCT_CLIENT_PAY.Value, "SFY2010_SW_T19"))

              )

        / (Sum(Fields!UNITS.Value, "SFY2010_SW_T19") / Sum(Fields!DISTINCT_CLIENT_PAY.Value, "SFY2010_SW_T19"))

        ).IsNaN,



        0.00,



        (

              (

                    (Sum(Fields!UNITS.Value, "SFY2011_SW_T19") / Sum(Fields!DISTINCT_CLIENT_PAY.Value, "SFY2011_SW_T19"))

                    - (Sum(Fields!UNITS.Value, "SFY2010_SW_T19") / Sum(Fields!DISTINCT_CLIENT_PAY.Value, "SFY2010_SW_T19"))

              )

              / (Sum(Fields!UNITS.Value, "SFY2010_SW_T19") / Sum(Fields!DISTINCT_CLIENT_PAY.Value, "SFY2010_SW_T19"))

        )

  )
A: 

The particular error is probably because you should do IsNaN(Value) instead of Value.IsNaN but just in case you're trying to use Iif() to prevent a divide by zero error, I'll give you a bonus tip.

Doing this...

=Iif(CouldBeZero = 0, 0, SomeValue / CouldBeZero)

...will always throw an error when CouldBeZero = 0 because the division is evaluated first and the result passed to the Iif() function.

Instead do this...

=Iif(CouldBeZero = 0, 0, SomeValue / Iif(CouldBeZero = 0, 1, CouldBeZero))

...to ensure the division works and zero is displayed.

JC