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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Filter table contents based on combinations of selected values

I have a table which I want to filter based on various combinations of Domiciles, without creating a long IF statement to determine all of the possible combinations - my DAX measure at the moment has VAR for all of the following: "Ghana", "India", "Pakistan" "Rest Of World":

 

VAR Ghana =
CALCULATE(
SELECTEDMEASURE()
, Domicile[CountryOfDomicile] = "Ghana"
)

 

I then have a RETURN statement which is an IF statement, but only adds them together or allows for each individual at a time

RETURN
IF(
SELECTEDVALUE( Domcile[CountryOfDomicile] ) = "India"
, India
, IF(
SELECTEDVALUE(Domcile[CountryOfDomicile] ) = "Ghana"
, Ghana
, IF(
SELECTEDVALUE( Domcile[CountryOfDomicile] ) = "Pakistan"
, Pakistan
, IF(
SELECTEDVALUE( Domcile[CountryOfDomicile]) = "Rest Of World"
, RestOfWorld
, India + Pakistan + Ghana + RestOfWorld
)
)
)
)

 

I would like a way to instead have a RETURN which allows for any combinations of the above (eg Ghana + Rest Of World, Ghana + Pakistan etc) depending on the end user's selection in the slicer.

 

All suggestions gratefully received!

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , if Rest of the world is just a value and do have data for it in table, then use measure

 

If( "Rest Of World" in values(Domicile[CountryOfDomicile]) ,CALCULATE( SELECTEDMEASURE(), all()), SELECTEDMEASURE())

 

 

if "Rest of the world" also has data in your table, then only SELECTEDMEASURE() should do

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thank you for replying.

Rest of World is a value, the same as Ghana etc - each row in the table represents an individual, and the domicile field contains one of these values.

 

The complication is that I want to show the sum of the data according to what the end user selects, which might not just be Ghana or Rest Of World but a combination of these (or any others)

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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