Skip to main content

ALLSELECTED DAX 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.

Its comes under Filter DAX function category.

Syntax:

ALLSELECTED ([<tableName> or <columnName>])

Description:

table - The name of table, this parameter is option and it cannot be an expression.
column - The name of column, this parameter is option and it cannot be an expression.

Download the sample Dataset file from below link:

SuperStoreUS-2015.xlxs


Now, create Measure to using DAX ALLSELECTED function and in that measure we will calculate 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 screen shot.

ALLSELECTED DAX Output

Now Select some Product sub category from Slicer.

ALLSELECTED DAX Output-2

So, you can see here, it is showing summation of only filtered Product sub category sales values against each row.

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

Comments

Popular posts from this blog

ALL DAX function

As it’s name suggests, Returns all the rows in a table, or all the values in a column.  ALL function removes the applied filters from the filter context. Its comes under Filter function DAX category.

LOOKUPVALUE DAX Function

Returns the value for the row that meets all criteria specified by search conditions. The function can apply one or more search conditions. Its comes under Filter function DAX category.