How do you show or hide based on expression in SSRS on a matrix column groups?

Anonymous
2023-02-09T18:56:30.18+00:00

I have a report in which I need to hide a column group value PTO in a matrix based on a parameter the user selects. I need to hide PTO in the user select PTO

0 on the parameter Include PTO?

Here the design view of my report;

pto1

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
3,061 questions
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2023-02-13T07:13:57.56+00:00

    Hi @Jannette Jones

    Yes, because this just hides the column, not modifies the data. If you want the variance and total value to change accordingly, you can modify your variance and total value expressions.

    For example, when calculating the total value, use the following expression:

    4

    =IIF(Parameters!IncludePTO.Value="Yes",Fields!Payroll.Value+Fields!OT.Value+Fields!PTO.Value,Fields!Payroll.Value+Fields!OT.Value)
    
    

    This expression means that when the value of IncludePTO is "Yes", calculate the added value of Payroll, OT, and PT, otherwise calculate the added value of Payroll and OT.

    Preview:

    5

    6

    Best regards,

    Aniya


1 additional answer

Sort by: Most helpful
  1. Anonymous
    2023-02-10T01:52:57.29+00:00

    Hi @Jannette Jones

    I did a simple test.

    First, according to your screenshot and description, I simply made a table and created a parameter "IncludePTO", the available values of the parameter are "Yes" and "No".

    Then we select the PTO column, right-click and select "Column Visibility", and edit the expression to "=IIF(Parameters!IncludePTO.Value="Yes", False,True)". This expression means that when the parameter value is "Yes", the column is not hidden, otherwise it is hidden. If you want to know more about the usage of "IIF", you can refer to this link: Decision Functions.

    1

    2

    Preview:

    3

    4

    Best regards,

    Aniya


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.