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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
webportal
Impactful Individual
Impactful Individual

DAX ALLEXCEPT: How to remove all filters but one?

In my simple table, I have 3 columns:

  • Date
  • Sales
  • Store

These are the numbers: 

enter image description here

I want to calculate the sales for all the years for each store:

 

All Except Store = SUMX(ALLEXCEPT(Table1;Table1[Store]);Table1[Sales])

This is returning the following: 

enter image description here

It's nonsense! It's removing ALL the filters, so to calculate the sales for all the years and KEEP the filters on the store using ALLEXCEPT I can use:

 

All Except Store2 = CALCULATE(SUM(Table1[Sales]); ALLEXCEPT(Table1;Table1[Store]))

 

This one works.

 

But why doesn't it work with SUMX?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@webportal,

I got response from PG:

AllExcept behaves differently when used as a set filter in Calculate or when used to return a table. In the former case, all filters removed except for the filters on the specified columns.

SUMX(ALLEXCEPT(Table1;Table1[Store]);Table1[Sales]) means return a table of all rows in Table1. The returned table has all columns in Table1 except the [Store] column. Afterwards, calculate the sum by iterating over the returned table.


Regards,
Lydia

View solution in original post

8 REPLIES 8
themistoklis
Community Champion
Community Champion

@webportal

 

Also you need pay a good attention on Calculate function.

 

The CALCULATE function changes the context in which the data is filtered, and evaluates the expression in the new context that you specify. For each column used in a filter argument, any existing filters on that column are removed, and the filter used in the filter argument is applied instead.

themistoklis
Community Champion
Community Champion

@webportal

 

Can you also check if this formula with SUMX works?

 

 

All Except Store = SUMX(ALLEXCEPT(Table1;Table1[Store]); CALCULATE(SUM(Table1[Sales])))

 

Yep, that one works too. CALCULATE has magical powers!

 

Here's the link to the pbix.

 

Thanks

AlB
Community Champion
Community Champion

@webportal

You are using the ALLEXCEPT in an unusual manner.

Create a new table to see what the result of ALLEXCEPT(Table1;Table1[Store]) is. I think that will clarify what is going on.

Anonymous
Not applicable

@webportal,

I got response from PG:

AllExcept behaves differently when used as a set filter in Calculate or when used to return a table. In the former case, all filters removed except for the filters on the specified columns.

SUMX(ALLEXCEPT(Table1;Table1[Store]);Table1[Sales]) means return a table of all rows in Table1. The returned table has all columns in Table1 except the [Store] column. Afterwards, calculate the sum by iterating over the returned table.


Regards,
Lydia

Anonymous
Not applicable

@webportal,

I will consult this issue internally. And you can use the dax below instead.

Measure 2 = SUMX(FILTER(ALL(Table1);Table1[Store] =MAX(Table1[Store]));Table1[Sales])



Regards,
Lydia

webportal
Impactful Individual
Impactful Individual

Ok, thanks a lot.
AlB
Community Champion
Community Champion

Hi @webportal

Can you share the pbix?

 

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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors