IIF help needed

  • if ( Sum (IIF(IsNothing(Fields1.Value), 0, Fields1.Value)), Field3.value) = 0 ) then

    0

    else

    (Sum (IIF(IsNothing(Fields2.Value), 0, Fields2.Value), Field3.value) / Sum (IIF(IsNothing(Fields1.Value), 0, Fields1.Value), Field3.value)

    i am struck in between, Can anybody please tell me how to make it to work?

  • Man i'm not clear with your expression specially sum(). Express your requirement in words

    -----------------------------------------------------------------------------------------------------------------------------------------------------------
    Please feel free to let me know if you are not clear or I’ve misunderstood anything.

    Thanks,
    Arunkumar S P

  • if ( Sum (IIF(IsNothing(Fields1.Value), 0, Fields1.Value)), Field3.value) = 0 ) then

    0

    else

    (Sum (IIF(IsNothing(Fields2.Value), 0, Fields2.Value), Field3.value) / Sum (IIF(IsNothing(Fields1.Value), 0, Fields1.Value), Field3.value)

    i am struck in between, Can anybody please tell me how to make it to work?

    What is the error you are getting?

    Try this:

    = IIF ( (IIF(IsNothing(Fields!Fields1.Value),0,Fields!Fields1.Value) + Fields!Field3.Value) = 0, 0,

    (IIF(IsNothing(Fields!Fields2.Value),0,Fields!Fields2.Value) + Fields!Field3.Value) / (IIF(IsNothing(Fields!Fields1.Value),0,Fields!Fields1.Value) + Fields!Field3.Value)

    But I have a doubt it will work because you have a case where you are dividing it by 0. Because the they way IIF works is, it will evaluate both the cases even if the expression is True or False. But give it a shot and see what kind of error you run into, if you do. Hopefully it will be smooth.

    By the way I am under the impression you are using SSRS 2005.

    - always Happy, always Prasanna

    §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§

    always Happy, always Prasanna 🙂

Viewing 3 posts - 1 through 2 (of 2 total)

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