DAX HANDBOOK
6.8 ALLSELECTED

If you wish to follow along, you can find PBIX/Excel files at the bottom of the article. 

Authors

Krešimir Ledinski

Krešimir Ledinski

Microsoft certified expert in the field of Business Intelligence. His biggest passions are DAX, M, and data modeling.

Kristian Radoš

Kristian Radoš

Experienced data analyst. Advanced in SQL, PowerApps and M language.

Explanation

ALLSELECTED is one of the most complex functions in DAX. When used improperly it can lead to unexpected results. As a rule of thumb, you should not use it in iterative functions. It is preferable to use it only as a CALCULATE filter remover, not as a table function.

ALLSELECTED comes into play once we want to make a distinction between direct filters plotted on a specific visual (e.g. matrix table in the picture below), and filters coming from other visuals on the canvas (e.q. color Slicer). If used as a CALCULATE filter remover, ALLSELECTED ignores all direct filters but keeps all indirect ones (such as the one coming from the Slicer).

ALL Color = CALCULATE([SalesAmount],ALL(DimProduct[Color]))
ALLSELECTED Color = CALCULATE([SalesAmount],ALLSELECTED(DimProduct[Color]))

As we can see in the picture above, if there are no filters coming from other visuals on the canvas, both types of calculation return the same value, which is the [SalesAmount] with the colors column ignored. The difference becomes evident once we introduce cross-filtering across visuals.

This time we can see a clear difference between the 2 measures. [ALL Color] is ignoring both direct and cross-filtered filters on the DimProduct[Color] column, while [ALLSELECTED Color] is removing only the DimProduct[Color] filter which is directly applied to the visual. The one coming from the slicer is preserved, therefore limiting the ALLSELECTED measure to ignore only the visible filters in the visual.

ALLSELECTED is mostly used to perform dynamic share in segment calculations.

Materials

We wish to create the best possible content!

If you are a novice looking for a better explanation of any element of the topic, feel free to comment on the part you didn't quite understand!

If you are an expert in DAX and believe certain topic lacks important internals, your comments are more than welcomed!

COMMENTS

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

OUR SERVICES

Prefer live training or consultations?

Table of Content

Table of Content

GET LATEST BI NEWS TO YOUR INBOX

Receive the latest updates on all business analyst news across all platforms.

By subscribing you are agreeing to our Privacy Policy.

Related blog posts

Held Excel training for Eksa Grupa

For the end of the year, we held Excel training for our colleagues from Eksa Grupa d.o.o. The participants of the training use Excel in their daily work, so it was very useful for them to hear how to improve and speed up the data processing and analysis processes. The...

Read more

Održana Excel edukacija za Eksa Grupu

Za kraj godine održali smo Excel edukaciju za naše kolege iz Eksa Grupa d.o.o. Polaznici edukacije u svakodnevnom radu koriste Excel, stoga im je bilo vrlo korisno čuti kako unaprijediti i ubrzati procese obrade i analize podataka. Edukacija je bila prilagođena radu na njihovim stvarnim zadacima te smo prošli kroz...

Read more

Uspješna suradnja s kompanijom MarinExpert u domeni izrade poslovnih aplikacija

Nakon 6 mjeseci intezivne suradnje s rukovoditeljstvom kompanije MarinExpert d.o.o. iz Dugopolja, s velikim zadovoljstvom možemo objaviti da je implementacija sveobuhvatnog aplikativnog rješenja za planiranje i proizvodnju tipiziranih protuprovalnih vrata uspješno dovedena u fazu produkcije! Kako je došlo do suradnje? MarinExpert d.o.o. je jedan od vodećih proizvođača ugostiteljske opreme i...

Read more

New employee in the team!

After a long search, we are very happy to announce that we have hired a new member and expanded our work team! Karlo will strengthen our Power Platform team in the part of business analysis, which includes the following technologies:PowerBI,PowerQuery,PowerPivot/Tabular. He developed his business knowledge in the pharmaceutical industry, and...

Read more
0
Would love your thoughts, please comment.x
()
x
Scroll to Top