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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
yharfush
Frequent Visitor

Measures using ALLEXCEPT and slicers

Hello,

 

I am having trouble using an ALLEXCEPT measure that takes into account the slicers I have placed on my report.

 

My table has different Vehicle penetration by state, the table contains the Socioeconomic level-Gender-Age Group detail:

 

StateVehicleSocioeconomic levelGenderAge GroupPenetrationPopulation
NYINTERNETA/B/C+Men13 a 18180194
NYINTERNETA/B/C+Men19 a 24217222
NYINTERNETDEMen25 a 34309319
NYINTERNETDEWomen35 a 44281285
NYINTERNETDEWomen45 a 64318334
NYRADIODEMen13 a 18195195
NYRADIOA/B/C+Men19 a 24224225
NYRADIOA/B/C+Men25 a 34336339
NYRADIOA/B/C+Women35 a 44312316
NYRADIODEWomen45 a 64304384

 

 

In my report I have 4 slicers (one for Socioeconomic level, one for Gender, one for Age Group and one for Vehicle). I have also created a Shape map on which states get a different color depending on whether the % of penetration of a vehicle in that state is higher (green) or lower (red) than the national % penetration for that same vehicle.

 

So I created two measures:

 

% Penetration = sum('MyTable'[Penetration]) / sum('MyTable'[Population])
National % Penetration = CALCULATE([% Penetration], ALLEXCEPT('MyTable', 'MyTable'[Vehicle]))
 
This is working perfectly when I have not applied any slicers on Gender, Socioeconomic level or Age Group. However, when I select any of these slicers, the National % Penetration doesn't change to adjust to that selection, so the colors displayed on the map are not correct. The % Penetration variable is taking into account the slicer selection but the National % Penetration is not.
 
How can I fix this?
Any help would be greatly appreciated!
1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

That's because your ALLEXCEPT removes all other filters except the ones that you specify. Try adding your other columns into your ALLEXCEPT function.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

That's because your ALLEXCEPT removes all other filters except the ones that you specify. Try adding your other columns into your ALLEXCEPT function.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Ah yes this works! Thank you :)!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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