none
SSRS Expression for hiding some columns in column group based on parameter

    Question

  • I have a matrix table with column name WeekName which has the values of W1, W2, W3 and W4 which expands 4 columns when run. I need to hide the columns based on a parameter called WeekPar as follows:

    If WeekPar = 1, hide columns W1,

    If WeekPar = 2, hide columns W1 and W2

    What would be the expression for that?

    I know how to hide individual columns, but not some of the columns in a group. Is this possible?

    Thanks in advance!

    Friday, January 03, 2014 12:51 AM

Answers

  • Hi QQFA,

    After testing the issue in my local environment, we can refer to the steps below to achieve your requirement:

    1. Right-click the WeekName column to open the Column Visibility property dialog box.
    2. Using the expression below to control the Column Visibility (supposing the cell which contains WeekName field named WeekName ):
      =switch(Parameters! WeekPar.Value=1,ReportItems! WeekName.Value="W1", Parameters! WeekPar.Value=2,ReportItems! WeekName.Value="W1" or ReportItems! WeekName.Value="W2")

    If you have any other questions, please feel free to ask.

    Thanks,
    Katherine Xiong


    Katherine Xiong
    TechNet Community Support

    Friday, January 03, 2014 4:03 PM

All replies

  • Hi,

    Select each column and then open the Properties-->Visibility-->Hidden and then select expression and write like =IIF(Parameters!P_Name.value="W1", FALSE, TRUE). Based on your parameter selection It will display the columns. For Example when you select W1 it is display column c1. Same you will have at group level.

    By default Hidden will have value False. 


    Thanks Shiven:) If Answer is Helpful, Please Vote


    Friday, January 03, 2014 1:54 AM
  • Hi QQFA,

    After testing the issue in my local environment, we can refer to the steps below to achieve your requirement:

    1. Right-click the WeekName column to open the Column Visibility property dialog box.
    2. Using the expression below to control the Column Visibility (supposing the cell which contains WeekName field named WeekName ):
      =switch(Parameters! WeekPar.Value=1,ReportItems! WeekName.Value="W1", Parameters! WeekPar.Value=2,ReportItems! WeekName.Value="W1" or ReportItems! WeekName.Value="W2")

    If you have any other questions, please feel free to ask.

    Thanks,
    Katherine Xiong


    Katherine Xiong
    TechNet Community Support

    Friday, January 03, 2014 4:03 PM