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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
nanacobsbs
Frequent Visitor

switch DAX


I want show the regions which selected in the slicer in the card visual.
I have created the following code measure.
To Show "Global"in the card when all regions are checked in the slicer, which code should I use?


Regions =
SWITCH(TRUE(),
"America" in ALLSELECTED('Switch Regions'[Regions]),"America",
"Europe" in ALLSELECTED('Switch Regions'[Regions]), "Europe",
"Asia" in ALLSELECTED('Switch Regions'[Regions]), "Asia",
"Japan" in ALLSELECTED('Switch Regions'[Regions]), "Japan"

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @nanacobsbs 

try to plot the card with such measure:

RegionSelection = 
IF(
    COUNTROWS(ALLSELECTED(Regions[Regions]))=COUNTROWS(ALL(Regions[Regions])),
    "All",
    CONCATENATEX(
        ALLSELECTED(Regions[Regions]),
        Regions[Regions],
        ","
    )
)

 

it works like this:

FreemanZ_0-1671762096615.png

FreemanZ_1-1671762118270.png

FreemanZ_2-1671762154231.png

 

View solution in original post

2 REPLIES 2
FreemanZ
Super User
Super User

hi @nanacobsbs 

try to plot the card with such measure:

RegionSelection = 
IF(
    COUNTROWS(ALLSELECTED(Regions[Regions]))=COUNTROWS(ALL(Regions[Regions])),
    "All",
    CONCATENATEX(
        ALLSELECTED(Regions[Regions]),
        Regions[Regions],
        ","
    )
)

 

it works like this:

FreemanZ_0-1671762096615.png

FreemanZ_1-1671762118270.png

FreemanZ_2-1671762154231.png

 

Thank you!!!  It's done!

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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