开发者

SSRS 2008: iif IsNan statement Error wrong number of arguments

开发者 https://www.devze.com 2023-01-04 14:39 出处:网络
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 wha

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"))

        )

  )


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.


Instead of having that big complex value before .IsNAN, just use Single.IsNAN

0

精彩评论

暂无评论...
验证码 换一张
取 消