iif condition

  • Hi,

    I have the following requirement and have to create the condition in SSRS based on this:

    'Default from from_loc_3. If from_loc3 is null use from_loc2. If from_loc2 is null use from_loc1'

    based on this I have created this condition but it doesnt work:

    =iif(Fields!FROM_LOC2.Value = "", Fields!FROM_LOC1.Value, iif(Fields!FROM_LOC3.Value = "", Fields!FROM_LOC2.Value, Fields!FROM_LOC3.Value))

    I mean if the value for FROM_LOC3 exists, then the value is left as blank which is wrong because if the value for FROM_LOC3 exists, then the same whould get populated.

    Does someone have any suggestions for this ?

    Thanks.

  • =iif(Fields!FROM_LOC3.Value = "", iif(Fields!FROM_LOC2.Value = "", Fields!FROM_LOC1.Value, Fields!FROM_LOC2.Value), Fields!FROM_LOC3.Value)

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Koen Verbeeck (8/27/2013)


    =iif(Fields!FROM_LOC3.Value = "", iif(Fields!FROM_LOC2.Value = "", Fields!FROM_LOC1.Value, Fields!FROM_LOC2.Value), Fields!FROM_LOC3.Value)

    That worked !! thanks very much for your help.

  • No problem, glad to help.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

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

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