Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
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!
Solved! Go to Solution.
Try:
Selected locations =
VAR _Selected =
CONCATENATEX (
VALUES ( 'Slicer table'[Location] ),
'Slicer table'[Location],
", "
)
RETURN
"Selected Location(s): " & _Selected
Proud to be a Super User!
Paul on Linkedin.
Try:
Selected locations =
VAR _Selected =
CONCATENATEX (
VALUES ( 'Slicer table'[Location] ),
'Slicer table'[Location],
", "
)
RETURN
"Selected Location(s): " & _Selected
Proud to be a Super User!
Paul on Linkedin.
User | Count |
---|---|
59 | |
59 | |
56 | |
38 | |
29 |
User | Count |
---|---|
80 | |
62 | |
45 | |
40 | |
39 |