Home » DAX » DAX – ALLSELECTED function

DAX – ALLSELECTED function

ALLSELECTED DAX Function

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

So, Let’s start with an example,  you can download the sample Dataset from below link

ALLSELECTED DAX function Sample Data

ALLSELECTED DAX function Sample Data




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 ALLSELECTED definition, by default it returns the sum of total sales of all rows and after filters returns the sum of applied filters values, let’s have a look below two screen shots.

ALLSELECTED DAX function

Without filter ALLSELECTED DAX function

ALLSELECTED DAX function

After filter ALLSELECTED DAX function

Hope you enjoyed the post. Your valuable feedback, question, or comments about this post are always welcome.



Leave a Reply