Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
In my simple table, I have 3 columns:
These are the numbers:
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:
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?
Solved! Go to Solution.
@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
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.
Can you also check if this formula with SUMX works?
All Except Store = SUMX(ALLEXCEPT(Table1;Table1[Store]); CALCULATE(SUM(Table1[Sales])))
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.
@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
@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
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
79 | |
73 | |
58 | |
36 | |
32 |
User | Count |
---|---|
90 | |
60 | |
60 | |
49 | |
45 |