Using IIf Condition in SSRS 2005

  • I'm having the Following Table in SSRS 2005 Reports.....

    A B C Total

    2000 100 100

    1500 5000 150

    2340 100 1000

    1000 100 100

    Now I want the TOTAL in such a way that...

    If A < B, Then (A/1000)*C (the Value of C)

    If A > B, Then (B/1000)*C (the Value of C)

    How to Write this Field Expression Here...

    Please give me the Expression

    Thank You

  • IIf(A < B, ((A/1000)*C), (B/1000)*C))

    Is there ever an instance where A = B?

    If so, you'll maybe want to use SWITCH instead of IIF. SWITCH evaluates a list of expressions in pairs and returns the second part of the pair corresponding to the first expression in the list that is True.

    SWITCH(A B,(B/1000)*C, A = B, A=B Calculation)

    will work like:

    if A<B then (A/1000)*C else

    if A>B then (B/1000)*C else

    if A=B then perform the A=B calculation

    HTH

    [font="Comic Sans MS"]toolman[/font]
    [font="Arial Narrow"]Numbers 6:24-26[/font]

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

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