web
You’re offline. This is a read only version of the page.
close
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

  

I have the same question (0)
  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    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)

  • Community Member Profile Picture
    on at

    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,

  • Verified answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    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

    Hi Sergei,

    Thank you. Finally, It works. :)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans