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

     [<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

Related Support Forum Posts

Cumulative Banking Transactions – ALL vs ALLSELECTED within cumulative totals
Problem with ALLSELECTED Context
Calculate application cost as pct of total cost for all applications

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

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

SUM (Sales[Sales Amount]),

ALLSELECTED(Orders[Product Sub-Category])

Related Course Modules

Center of Excellence


Download our comprehensive DAX Formula Reference Guide as perfect companion as you learn how to use DAX formulas within Power BI.

Download DAX Formulas Reference Guide
Download DAX Formula Reference Guide