ALL vs. ALLSELECTED in DAX

ALL vs. ALLSELECTED DAX functions

The biggest difference between ALL and ALLSELECTED is that the ALL function ignores all filters, regardless of where they are coming from. In contrast, the ALLSELECTED function only ignores filters that are coming from the inner query.

Returning Total Sales of all Selected Countries

The following expression in DAX would return the total sales for all countries in all scenarios. For example, the countries Australia, Canada and France were selected in the slicer, but yet the measure Total Sales All Countries still returns the total sales across all countries:

image

Advertisementshttps://c0.pubmine.com/sf/0.0.3/html/safeframe.htmlREPORT THIS AD

Figure 1.1

In this scenario, you might want to return Total Sales for all countries selected in the slicer (allselected), $13,682,863.16. This can be quite tricky, especially if you didn’t know of the existence of the ALLSELECTED function. Let’s write the expression in Figure 1.1 a different way and look at the results.

Figure 1.2

In this example, you can clearly observe that ALLSELECTED is providing a different way to analyze your data. I love this dynamic approach to analyzing data that is provided by simply modifying the ALL function to use ALLSELECTED!

Ref: https://mitchellpearson.com/2020/09/14/understanding-row-context-in-dax-and-power-bi/#:~:text=The%20biggest%20difference%20between%20ALL,coming%20from%20the%20inner%20query.

Ref: https://blog.enterprisedna.co/the-difference-between-all-and-allselected-dax-functions-in-power-bi/