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
paul_sanders
Frequent Visitor

Odd behavior in results of CALCULATE(..., ALL(<column>))

I'm having trouble undertanding the results from a measure using CACLULATE(..., ALL(<column>) ) where I want to get the grand total over all values of the column.  The results depend on whether I have no slicer on some other column in the table, or a slicer that selects all values (which seems particluarly odd).
 
Any help appreciated! 
 

PBI Issue1.pngPBI Issue2.png

 

 
1 ACCEPTED SOLUTION
paul_sanders
Frequent Visitor

Thanks @amitchandak   

I can't use ALL(<table>) because that would blow away any filters/slicers I have on other columns.

 

I think I have the answer, and seems I fell into the auto exist trap described here: https://www.sqlbi.com/articles/understanding-dax-auto-exist/ 

Lesson learnt - for years my models have all been more complex star schemas, and here the data was a simple single table. But combining that with a non trivial calculation using ALL() leads to this odd behavior. 

The reason I dont get the same issue with PowerPivot or just via a DAX calculation is (I believe) because the issue is specific to the use of SUMMARIZECOLUMNS generated by the Power BI UI. I assume the difference between having no selection in the slicer vs everything selected is because in the first case the query generated doesn't reflect the slicer at all, and in the second case it includes it with all the values, that triggers this odd auto exist. 

 

View solution in original post

2 REPLIES 2
paul_sanders
Frequent Visitor

Thanks @amitchandak   

I can't use ALL(<table>) because that would blow away any filters/slicers I have on other columns.

 

I think I have the answer, and seems I fell into the auto exist trap described here: https://www.sqlbi.com/articles/understanding-dax-auto-exist/ 

Lesson learnt - for years my models have all been more complex star schemas, and here the data was a simple single table. But combining that with a non trivial calculation using ALL() leads to this odd behavior. 

The reason I dont get the same issue with PowerPivot or just via a DAX calculation is (I believe) because the issue is specific to the use of SUMMARIZECOLUMNS generated by the Power BI UI. I assume the difference between having no selection in the slicer vs everything selected is because in the first case the query generated doesn't reflect the slicer at all, and in the second case it includes it with all the values, that triggers this odd auto exist. 

 

amitchandak
Super User
Super User

@paul_sanders , Based on what I got.

 

Use table name in all

all(Vehicle)

 

or use fact the table from where the count is column

all(Fact)

 

 

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.