ALLSELECTED
A table's rows or columns' values as the filters from outside the visual leave them (slicers, the page), ignoring its own rows and columns.
Group: Filter. Compatible with DAX.
Syntax
ALLSELECTED ( <tableName> )
ALLSELECTED ( <columnName> [, <columnName>] … )
ALLSELECTED ( )
| Parameter | Type | Description |
|---|---|---|
tableName | Table | A table whose filters go back to what the visual's surroundings set. |
columnName | Column repeatable | A column treated the same way; several may be given. |
Returns
Table. As a filter, the filters from outside the visual put back; as a table, the values they leave.
Remarks
- In a visual, each cell is filtered by its own row and column, and all cells by the slicers and the page. ALLSELECTED removes the first kind and keeps the second, so a share computed with it adds up to the whole of what the reader has selected.
- In a query, the filter tables of
SUMMARIZECOLUMNSand the filters of an outerCALCULATETABLEplay the part of the slicers. ALLignores the selection as well. Use ALL for a share of everything, ALLSELECTED for a share of what is selected.- With no argument, it does this for every table at once, as a filter of
CALCULATE. - It refers to the filters around the visual or the query. Inside iterations a measure runs on its own, the result is harder to predict: keep it to measures shown in a visual.
Examples
A share of the selection and a share of everything
The filter table stands for a slicer with Pils and IPA picked.
EVALUATE
SUMMARIZECOLUMNS (
Products[Product],
FILTER ( ALL ( Products[Product] ), Products[Product] = "Pils" || Products[Product] = "IPA" ),
"Liters", [Liters sold],
"Share of selected", DIVIDE ( [Liters sold], CALCULATE ( [Liters sold], ALLSELECTED ( Products[Product] ) ) ),
"Share of all", DIVIDE ( [Liters sold], CALCULATE ( [Liters sold], ALL ( Products[Product] ) ) )
)
ORDER BY Products[Product]
| Products[Product] | Liters | Share of selected | Share of all |
|---|---|---|---|
| IPA | 331884 | 0.2483771263499 | 0.183720341905702 |
| Pils | 1004326 | 0.7516228736501 | 0.555962674021001 |
The selected districts, by category
Two districts are selected. ALLSELECTED removes the district of each row but keeps its category, so each row shows its category's liters in both districts.
EVALUATE
SUMMARIZECOLUMNS (
Products[Category],
Places[District],
FILTER ( ALL ( Places[District] ), Places[District] = "Frogner" || Places[District] = "Storo" ),
"Liters", [Liters sold],
"In the selected districts", CALCULATE ( [Liters sold], ALLSELECTED ( Places[District] ) )
)
ORDER BY Products[Category], Places[District]
| Products[Category] | Places[District] | Liters | In the selected districts |
|---|---|---|---|
| Beer | Frogner | 148541 | 279532 |
| Beer | Storo | 130991 | 279532 |
| Cider | Frogner | 3379 | 6182 |
| Cider | Storo | 2803 | 6182 |
Related functions
ALL, REMOVEFILTERS, CALCULATE, SUMMARIZECOLUMNS, ISFILTERED.