DAX Function Guide

ALLSELECTED Function (DAX)
Empty image or helper icon

Sam McKay

CEO & Founder

How does the ALLSELECTED Function (DAX) work?
The ALLSELECTED function (DAX) returns all the rows in a table or all the values in a column, while ignoring any filters that might have been applied inside the query, while keeping any filters that came from the outside.
ALLSELECTED Function (DAX) Formula Syntax

ALLSELECTED(
     [<tableName> | <columnName>[, <columnName>[, <columnName>[,…]]]] )
)

How do you use the ALLSELECTED Function (DAX)?

ALLSELECTED is used to obtain visual totals in queries. It is used as a table expression if it has at least one argument. 

If there is one argument, it will be either tableName or columnName. If there is more than one argument, they must be columns from the same table. 

Related Blog Posts

Loading

Considerations when using the ALLSELECTED Function (DAX)?

This function is different from the other ALL() functions because it retains all filters explicitly set within the query, and it retains all context filters other than row and column filters. 

ALLSELECTED can either return a table or remove filters and restore a previous filter context. Both instances can be done by accessing and using the last shadow filter context left by an iterator on the stack of filter contexts.

Related Video Tutorials

Loading

Formula examples using the ALLSELECTED Function (DAX)

SUMMARIZE (
ALLSELECTED ( table ),
table[column1], tabls[column2]
)

= CALCULATE (
SUM (Sales[Sales Amount]),
ALLSELECTED ()
)

= CALCULATE(
Sum(Orders[Sales]),
ALLSELECTED(Orders[Product Sub-Category])
)

Related Courses

Loading