Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

How to get the text when multiple values are picked in a slicer?

Hello, I have the following DAX code that returns a single value like "St. Louis". The intent is to fill a card visualization with the values. 

_M_AgencyName = 
    VAR crazyStuff = SELECTEDVALUE(Office[Agency Name], blank())
    RETURN
    SWITCH(crazyStuff, 
        "St.Louis", "St. Louis",
        "Omaha", "Omaha",
        "Kansas City", "Kansas City",
        "Phoenix", "Phoenix",
        "Chicago", "Chicago",
        Blank(), "All"
        )

But what if there is more than one value selected in the slicer? I just want the text, something like "Chicago, St. Louis, Omaha" if that's what is selected. So I tried this code, but it didn't work. All the other posts I have found are not helpful.

_M both = 
VAR allofthem = ALLSELECTED(Office[Agency Name])
RETURN allofthem

Thanks!

 
1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

Try:

Selected locations =
VAR _Selected =
    CONCATENATEX (
        VALUES ( 'Slicer table'[Location] ),
        'Slicer table'[Location],
        ", "
    )
RETURN
    "Selected Location(s): " & _Selected




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

1 REPLY 1
PaulDBrown
Community Champion
Community Champion

Try:

Selected locations =
VAR _Selected =
    CONCATENATEX (
        VALUES ( 'Slicer table'[Location] ),
        'Slicer table'[Location],
        ", "
    )
RETURN
    "Selected Location(s): " & _Selected




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.