ALLSELECTED DAX Function (Filter)

Returns all the rows in a table, or all the values in a column, ignoring any filters that might have been applied inside the query, but keeping filters that come from outside.

Syntax

ALLSELECTED ( [<TableNameOrColumnName>] [, <ColumnName> [, <ColumnName> [, … ] ] ] )
Parameter Attributes Description
TableNameOrColumnName Optional

Remove all filters on the specified table or column applied within the query.

ColumnName Optional
Repeatable

A column in the same base table.

Return values

Table An entire table or a table with one or more columns.

Remarks

This function removes the corresponding filters from the filter context, restoring the last shadow filter context. It does not materialize the resulting table when called directly in a filter argument of CALCULATE or CALCULATETABLE .

ALLSELECTED can be used as a table expression when it has at least one argument.
ALLSELECTED without arguments can be used only as a CALCULATE or CALCULATETABLE modifier and removes all the filters from the filter context.

ALLSELECTED supports multiple columns as argument since May 2019.
In former versions this syntax is equivalent of ALLSELECTED ( table[column1], table[column2] ):

SUMMARIZE (
    ALLSELECTED ( table ),
    table[column1],
    tabls[column2]
)
» 7 related articles
» 3 related functions

Examples

ALLSELECTED is typically used as a CALCULATE modifier.

CALCULATE ( ..., ALLSELECTED () )
CALCULATE ( ..., ALLSELECTED ( table ) )
CALCULATE ( ..., ALLSELECTED ( table[column] ) )

ALLSELECTED can be used as a table function, even though it is not a best practice.

EVALUATE
CALCULATETABLE (
    { COUNTROWS ( ALLSELECTED ( Product ) ) },
    Product[Category] = "Audio"
)

Be aware that using ALLSELECTED in an iterator could produce unintuitive results.

EVALUATE
CALCULATETABLE (
    ADDCOLUMNS (
        ALL ( 'Product'[Category] ),
        "Sales Amount", [Sales Amount],
        "Sales Sel",
            CALCULATE (
                [Sales Amount],
                ALLSELECTED ( Product[Category] )
            )
    ),
    Product[Category] IN { "Audio", "Computer" }
)
Product[Category] Sales Amount Sales Sel
Audio 384,518.16 30,591,343.98
TV and Video 4,392,768.29 30,591,343.98
Computers 6,741,548.73 30,591,343.98
Cameras and camcorders 7,192,581.95 30,591,343.98
Cell phones 1,604,610.26 30,591,343.98
Music, Movies and Audio Books 314,206.74 30,591,343.98
Games and Toys 360,652.81 30,591,343.98
Home Appliances 9,600,457.04 30,591,343.98

Related articles

Learn more about ALLSELECTED in the following articles:

Related functions

Other related functions are:

Last update: Nov 7, 2024   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo, John Mayer

Microsoft documentation: https://docs.microsoft.com/en-us/dax/allselected-function-dax

2018-2024 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Volatile

A volatile function may return a different result every time you call it, even if you provide the same arguments. Click to read more.

Deprecated

This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

Contribute

Want to improve the content of ALLSELECTED? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.