SSRS Expression -- Evaluating against Multiple FIELD Values (Not Parameter Values)

  • Hello,

    Trying to get this to work. I have 7 different product lines.. each one has different, let's say, "Sales Stages". Some Product Lines share the same Sales Stages while some are completely different. There are about 18 different sales stages.

    I currently have this.

    =IIF(Fields!PRODUCT_LINE.Value=1, "First_Sales_Stage",

    IIF(Fields!PRODUCT_LINE.Value=2, "First_Sales_Stage",

    IIF(Fields!PRODUCT_LINE.Value=3, "First_Sales_Stage",

    IIF(Fields!PRODUCT_LINE.Value=4, "Second_Sales_Stage",

    IIF(Fields!PRODUCT_LINE.Value=5, "Third_Sales_Stage",........etc (about 18 more lines of this).

    As you can see, Product Line 1 - 3 all share the same "Sales Stage". All I want to know is how I can implement something like this (below).

    =IIF(Fields!PRODUCT_LINE.Value IN (1,2,3) "First_Sales_Stage",

    IIF(Fields!PRODUCT_LINE.Value=4, "Second_Sales_Stage",

    IIF(Fields!PRODUCT_LINE.Value=5, "Third_Sales_Stage"........etc.

    This does not work. I want to combine product lines that share the same Sales Stage. Any help would be greatly appreciated.

    Thanks.

  • Answer:

    IIF(Fields!PRODUCT_LINE.Value = 1 OR Fields!PRODUCT_LINE.Value = 2 OR Fields!PRODUCT_LINE.Value = 3, etc, etc)

    Mess with it long enough the answer will just come!

  • copett86 (7/16/2012)


    Hello,

    Trying to get this to work. I have 7 different product lines.. each one has different, let's say, "Sales Stages". Some Product Lines share the same Sales Stages while some are completely different. There are about 18 different sales stages.

    I currently have this.

    =IIF(Fields!PRODUCT_LINE.Value=1, "First_Sales_Stage",

    IIF(Fields!PRODUCT_LINE.Value=2, "First_Sales_Stage",

    IIF(Fields!PRODUCT_LINE.Value=3, "First_Sales_Stage",

    IIF(Fields!PRODUCT_LINE.Value=4, "Second_Sales_Stage",

    IIF(Fields!PRODUCT_LINE.Value=5, "Third_Sales_Stage",........etc (about 18 more lines of this).

    As you can see, Product Line 1 - 3 all share the same "Sales Stage". All I want to know is how I can implement something like this (below).

    =IIF(Fields!PRODUCT_LINE.Value IN (1,2,3) "First_Sales_Stage",

    IIF(Fields!PRODUCT_LINE.Value=4, "Second_Sales_Stage",

    IIF(Fields!PRODUCT_LINE.Value=5, "Third_Sales_Stage"........etc.

    This does not work. I want to combine product lines that share the same Sales Stage. Any help would be greatly appreciated.

    Thanks.

    Even easier is to use the Switch statement

    =SWITCH(Fields!PRODUCT_LINE.Value<=3,"First_Sales_Stage",

    Fields!PRODUCT_LINE.Value=4, "Second_Sales_Stage",

    Fields!PRODUCT_LINE.Value=5, "Third_Sales_Stage", and so on.)

    The switch statement will return the value given for the first test that evaluates to true.

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

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