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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
wynhodgkiss
Helper III
Helper III

Using SWITCH with multiple conditions, SELECTEDVALUE need an option for all

I'm using SELECTEDVALUE to define 2 variables that I'm using in a switch statement like so:

 

NEW_MEASURE =
var _inditype = SELECTEDVALUE(MeasureTable[IndicatorType])
var _nation = SELECTEDVALUE(Brick_Account[Nation])

RETURN
SWITCH(
    TRUE(),
       _inditype = "Values LC" && _nation = "REPUBLIC OF IRELAND", FORMAT([IRE sales measure],"€0,0"),
    _inditype = "Values LC" && _nation = "UNITED KINGDOM", FORMAT([UK GBP sales measure],"£0,0"),
     _inditype = "Standard Units" && _nation = "REPUBLIC OF IRELAND", FORMAT([IRE SU measure],"0,0"),
   _inditype = "Standard Units" && _nation = "UNITED KINGDOM", FORMAT([UK SU measure],"0,0"),
     _inditype = "Values EUR" && _nation = "REPUBLIC OF IRELAND", FORMAT([IRE sales measure],"€0,0"),
    _inditype = "Values EUR" && _nation = "UNITED KINGDOM", FORMAT([UK EUR ales measure], "€0,0"),
   _inditype = "Values GBP" && _nation = "REPUBLIC OF IRELAND", FORMAT([IRE GBP sales measure],"£0,0"),
   _inditype = "Values GBP" && _nation = "UNITED KINGDOM",   FORMAT([UK GBP sales measure],"£0,0"))
 
Is there a way to either define the variable _nation differently or a new conditon within the SWITCH statement that will allow me to add an "ALL" option when both UNITED KINGDOM & REPUBLIC OF IRELAND are selected or ALL via a slicer?
 
ps; the above measure is used in cards and a table and is only a small sample, there are more conditions. I also have a much simpler measure to use in charts but I have the same requirement for that too
1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @wynhodgkiss 

SELECTEDVALUE will return blank by default if more than one values are selected so assuming that there are only two countries, you can use something like isblank(_nation) = uk + ire

This will return the total value for card and  the total value in a table at the total row only.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

2 REPLIES 2
wynhodgkiss
Helper III
Helper III

Perfect, thanks so much

danextian
Super User
Super User

Hi @wynhodgkiss 

SELECTEDVALUE will return blank by default if more than one values are selected so assuming that there are only two countries, you can use something like isblank(_nation) = uk + ire

This will return the total value for card and  the total value in a table at the total row only.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.