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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
DataSkills
Helper II
Helper II

Unexpected behaviour of ALLEXCEPT

Hi all, 

 

I have a measure as follows:

Sales ALLEXCEPT = CALCULATE(sum('Reseller Sales'[SalesAmount]), ALLEXCEPT(Reseller, Reseller[ResellerName]))
My understanding of this is that it will sum up the 'Reseller Sales'[SalesAmount], ignoring ALL filters except those that come from Reseller[ResellerName]. So if I have a slicer for Year and for say Country, these will have no impact on the result, but if I put in a slicer for Reseller Name, this WOULD have an impact. 

However, this is not what I am seeing. Adding a year slicer (from Calendar[Date], joined to 'Reseller Sales'[Order Date]) affects the result. But the slicer for Country (from Geography[Country] to 'Reseller Sales'[Country]) has no impact. I am getting confused about this behaviour.  Please tell me what I am missing about the behaviour of ALLEXCEPT! Thank you in advance!
1 ACCEPTED SOLUTION
ValtteriN
Super User
Super User

Hi,

ALLEXCEPT removes the filters from the table in question, but not from related tables. If a filter affects Reseller Sales it will have an effect to you end result. 

Example:

ValtteriN_0-1706278504625.pngValtteriN_1-1706278519230.png

Measure 18 = CALCULATE(SUM('Table (24)'[Column1]),ALLEXCEPT('Calendar','Calendar'[Date]))

 

Measure 19 = CALCULATE(SUM('Table (24)'[Column1]),ALL('Table (24)'),KEEPFILTERS('Calendar'))


My example uses 3 slicers. From left to right: table (24)[date], calendar[date] and c2[date].


ValtteriN_2-1706278766216.png

 

ValtteriN_3-1706278781757.png

 

ValtteriN_4-1706278793718.pngValtteriN_5-1706278811354.png

Since all the slicers affect the base table (24) measure 18 value changes in all scenarios. Measure 19 only changes when calendar[date] is affected. 



I recommend using something similar to my measure 19.  The underlying reason for this behaviour is that your fact table is still affected by filters. Consider how the table visual is affected in my example.

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/






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

Proud to be a Super User!




View solution in original post

1 REPLY 1
ValtteriN
Super User
Super User

Hi,

ALLEXCEPT removes the filters from the table in question, but not from related tables. If a filter affects Reseller Sales it will have an effect to you end result. 

Example:

ValtteriN_0-1706278504625.pngValtteriN_1-1706278519230.png

Measure 18 = CALCULATE(SUM('Table (24)'[Column1]),ALLEXCEPT('Calendar','Calendar'[Date]))

 

Measure 19 = CALCULATE(SUM('Table (24)'[Column1]),ALL('Table (24)'),KEEPFILTERS('Calendar'))


My example uses 3 slicers. From left to right: table (24)[date], calendar[date] and c2[date].


ValtteriN_2-1706278766216.png

 

ValtteriN_3-1706278781757.png

 

ValtteriN_4-1706278793718.pngValtteriN_5-1706278811354.png

Since all the slicers affect the base table (24) measure 18 value changes in all scenarios. Measure 19 only changes when calendar[date] is affected. 



I recommend using something similar to my measure 19.  The underlying reason for this behaviour is that your fact table is still affected by filters. Consider how the table visual is affected in my example.

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/






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

Proud to be a Super User!




Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors