Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Switch expression in SSRS

(0) ShareShare
ReportReport
Posted on by

Hi everyone,

When I have a report parameter which is a toggle on or off which meant to hide some rows, can I use a Switch expression in its Row groups Visibility property.

Something like this :

=Switch(

Parameters!DataSet1_inclDetailPaym.Value <> "Yes" and Fields!LineType.Value = "L2_Detail", True,

Parameters!DataSet1_inclOtherPaym.Value <> "Yes" and Fields!LineType.Value = "L3_Other", True,

Parameters!DataSet1_inclRefund.Value <> "Yes" and Fields!LineType.Value = "L4_Refund", True,

False)

So DataSet1_incl.... is my report parameter that toggle on or off, and that Fields!LineType is my field that chosen as the Row Groups. And in its Visibility property, I put the expression like the above. The intention is, when the parameter is off (No) and the current Field!LineType of the current row is the specific word, the row with that LineType is hidden (True), else is hidden = False

No error in that expression, but during run, it says something wrong with my report.

Need help.

Thanks

  

  • Community Member Profile Picture
    on at
    RE: Switch expression in SSRS

    Hi Sergei,

    Thank you. Finally, It works. :)

  • Verified answer
    Sergei Minozhenko Profile Picture
    23,091 on at
    RE: Switch expression in SSRS

    Hi WWwong,

    Yes, for hidden expression True = Hide, False = Show.

    But for Switch statement syntax is

    SWITCH (

    condition, result,

    condition, result

    )

    And looks like there is no else (default) option, but you can try to workaround it by putting True as a condition to the last line

    SWITCH (

    condition, result,

    condition, result,

    True, result         -- Else

    )

  • Community Member Profile Picture
    on at
    RE: Switch expression in SSRS

    Hi Sergei,

    Isn't the last one is the "else", which I put as False, meaning it will show if not passed the previous condition ?

    ..and the expression is for the hidden, right? means if it is meet the condition it will set to True (hide it) else is False, show it.

    unless I'm wrong..:)

    Thanks,

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,091 on at
    RE: Switch expression in SSRS

    Hi WWwong,

    I think the problem is that "switch" statement doesn't have "else" option (or at least I don't see it)

    Try to add True condition to the last row.

    =Switch(
    
    Parameters!DataSet1_inclDetailPaym.Value <> "Yes" and Fields!LineType.Value = "L2_Detail", True,
    
    Parameters!DataSet1_inclOtherPaym.Value <> "Yes" and Fields!LineType.Value = "L3_Other", True,
    
    Parameters!DataSet1_inclRefund.Value <> "Yes" and Fields!LineType.Value = "L4_Refund", True,
    
    True, False)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,276 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,975 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans