ALLSELECTED function
- Returns all the rows in a table, or all the values in a column
- Removes context filters from columns and rows in the current query
- keeping filters that come from outside.
Syntax
ALLSELECTED ([<tableName> or <columnName>])
Sno. | Parameter | Description |
1 | table | The name of table, this parameter is option and it cannot be an expression |
2 | column | The name of column, this parameter is option and it cannot be an expression |
Let’s start with an example. You can download the sample dataset from the link below:
Now, create a Measure to using DAX ALLSELECTED function and in that measure do sum of ‘Sales’ column.
ALLSELECTED_DAX = CALCULATE(Sum(Orders[Sales]),ALLSELECTED(Orders[Product Sub-Category]))
According to the ALLSELECTED definition, by default, it returns the sum of the total sales for all rows, and after applying filters, it returns the sum of the values that match the applied filters. Let’s take a look at the two screenshots below.
Hope you enjoyed the post. Your valuable feedback, question, or comments about this post are always welcome.