ALLEXCEPT DAX Function in Power BI

The ALLEXCEPT DAX function removes all context filters on the table except filters that have been applied on the specified columns which are specified in the ALLEXCEPT function. It returns a table with all filters removed except for the filters on the specified columns.

DAX Syntax ALLEXCEPT(table, column[,column[,…]])

The function has the following parameters:

The first argument to the ALLEXCEPT function must be a reference to a base table. All subsequent arguments must be references to base columns. We cannot use table expressions or column expressions with the ALLEXCEPT function.

Example: Here in the formula, we are specifying that the measure is going to be filtered only based on the Name field of the Sheet1 table.

DAX

ALLEXCEPT Measure = CALCULATE(SUM(Sheet1[10th Marks]), ALLEXCEPT(Sheet1, Sheet1[Name]))

The output of the above measure is shown below:

ALLEXCEPT dax function in Power BI

In the above image we can see that the total measure value is shown in each row for all the countries even though we have filtered the countries by using slicer. So, it is not filtered based on Country field of the table.

At the same time, we can see that the measure is filtered on the Name field of the table.

Difference Between ALL, ALLSELECTED, and ALLEXCEPT Function

FunctionVisual FiltersSlicer FiltersPage/Report FiltersEffect
ALL(Sales)IgnoredIgnoredIgnoredRemoves all filters context from the table.
ALLSELECTED(Sales)IgnoredRespectedRespectedRemoves visual filters from the table.
ALLSELECTED(Sales[Product])Ignored (for Product)RespectedRespectedRemoves visual filters only for Product.
ALLEXCEPT(Sales, Sales[Product])Respected only for Product columnRespected only for Product columnRespected only for Product columnRemoves all filters context from the table except for the specified column.