ALLSELECTED Function (DAX)
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 Formula Syntax
ALLSELECTED(
[<tableName> | <columnName>[, <columnName>[, <columnName>[,…]]]] )
)
How do you use the ALLSELECTED function?
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
Considerations when using the ALLSELECTED function
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
Formula examples using the ALLSELECTED function
SUMMARIZE (
ALLSELECTED ( table ),
table[column1], tabls[column2]
)
= CALCULATE (
SUM (Sales[Sales Amount]),
ALLSELECTED ()
)
= CALCULATE(
Sum(Orders[Sales]),
ALLSELECTED(Orders[Product Sub-Category])
)