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
Mikelytics
Resident Rockstar
Resident Rockstar

ALL() not working as expected when putting columns of one Dimension table into matrix

Dear community, 

I work with Power BI for a very long time now, I frequently solve requests in the community and I was pretty sure that I have a very very good understanding of how CALCULATE() with ALL() and the other related functions work since I use it all the time without big problems. But recently in a session I built very very easy scenario to show somebody how filter context and CALCLATE() work in combination with ALL(). ANd there I was a little bit confused about the behaviour of Power BI in a very specific case which was when I put ALL() on a column in a dimension table, replace it with another value and then use the measure in combination with the ALL-column itself as well as a another column from the same dimension table within a matrix.

 

Maybe it is some kind of brain fog I have 😄 or an outlier or there is really a very basic behaviour which I did not know about before. So I hope you can help out here to explain what happens in the background. 🙂

 

Lets go to the sceanrio.

 

This is my very easy data model:

Mikelytics_3-1674571517792.png

with the following customer table and product table (focus is on customer table):

Mikelytics_1-1674571441691.png

Mikelytics_2-1674571475384.png

the fact table has 100 transactions and its a tpyical 1:n relation.

 

Now I write two measures:

 

 

Sales Amount = SUM(Fact_Sales[Values])
Sales Amount Group A with ALL on Group Column= 

CALCULATE(
    [Sales Amount],
    FILTER(
        ALL(Dim_Customer[CategoryGroup]),
        Dim_Customer[CategoryGroup] = "CGroup A"
    )
)

 

 

Question: In the picture below I can explain every single value except the combination highlighted in red. Because since I put ALL() on the group and replace it with the Value Group A I would expect to see in the field C1/CGroup B also the value 529. why is it not doing it in this case?

Mikelytics_4-1674571988269.png

 

This only happens when I put columns from one the dimension table in the matrix. All the other endless combination work properly (also which are not showon here). Ffor example when I take a column from the product table like in the matrix on botton left my world is in order. 😄

 

It really feels like I begin from the start so I hope you can free me! 😄

 

Best regards

Michael

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!
1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Mikelytics First, great question and well explained. The result you are seeing is correct, and it is happening because of auto-exist.  When columns from the same table are used then auto-exist kicks in, in this case, the customer group and the customer column belong to a single table.

 

If you create a seperate dimension table for the customer group and set a direct relationship with the sales table, and if you use this new dimension table in measure and in the matrix visual, you will not see this issue.

 

I hope this answer is helpful. If you have further questions, please feel free to reach out.

 

👉Learn Power BI  YouTube.gif to our YT channel - @PowerBIHowTo

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

6 REPLIES 6
parry2k
Super User
Super User

@Mikelytics glad you find it useful and clarified some concepts. And also thanks for subscribing the channel. Cheers!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@Mikelytics First, great question and well explained. The result you are seeing is correct, and it is happening because of auto-exist.  When columns from the same table are used then auto-exist kicks in, in this case, the customer group and the customer column belong to a single table.

 

If you create a seperate dimension table for the customer group and set a direct relationship with the sales table, and if you use this new dimension table in measure and in the matrix visual, you will not see this issue.

 

I hope this answer is helpful. If you have further questions, please feel free to reach out.

 

👉Learn Power BI  YouTube.gif to our YT channel - @PowerBIHowTo

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Wow! Thank you @parry2k ! The key word auto-exist was exactly what I was looking for. You helped me in two ways: Confirming that there is really something special ongoing as well as directly providing the solution. Awesome and thank you again! Directly started to follow your YT-channel!

 

Regarding the topic I also found a good sqlbi article using the key word auto-exist which goes deep into the topic. Understanding DAX Auto-Exist - SQLBI

 

Have good start into the week!

 

Best regards

Michael

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!

Also read this : Filter Arguments in CALCULATE - SQLBI  it explains how the syntax sugar is replaced in the engine.

LQuedas
Resolver II
Resolver II

Hey @Mikelytics ,

 

Can you check if the following change works for you?

 

Sales Amount Group A with ALL on Group Column


var _CustomerID = Fact_Sales[FK_CustomerID]

Return CALCULATE(
    [Sales Amount],
    FILTER(
        ALL(Dim_Customer[CategoryGroup]),
        AND(Dim_Customer[CategoryGroup] = "CGroup A",Dim_Customer[PK_CustomerID]=_CustomerID)
    )
)

 

Cheers, LQ

 

Hi @LQuedas 

 

Thank you very much and I appreciate your feedback!

 

The Measure you provided can not work since you refer in the variable on a column without using any function

 

2nd it is really not about changing anything. Its about understanding the fundamental behaviour of ALL() in combination with CALUCATE() in the given setup. I only look for the existing setup why in the red highlighted fields no values are shown. As you can see in all other matrixes there is a behaviour that existing filter context can be overwritten, excpet in this single combination.

 

Best regards

Michael

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!

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.