Power BI Level measures
ALLEXCEPT
Syntax
ALLEXCEPT(<table>,<column>[,<column>[,…]])
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. You cannot use table expressions or column expressions with the ALLEXCEPT function.
Return value
A table with all filters removed except for the filters on the specified columns.
Remarks
This function is not used by itself, but serves as an intermediate function that can be used to change the set of results over which some other calculation is performed.
As described in the following table, you can use the ALL and ALLEXCEPT functions in different scenarios.
This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.
Example
The following example presents a formula that you can use in a measure.
The formula sums SalesAmount_USD and uses the ALLEXCEPT function to remove any context filters on the DateTime table except if the filter has been applied to the CalendarYear column.
= CALCULATE(SUM(ResellerSales_USD[SalesAmount_USD]), ALLEXCEPT(DateTime, DateTime[CalendarYear]))
Because the formula uses ALLEXCEPT, whenever any column but CalendarYear from the table DateTime is used to slice the PivotTable, the formula will remove any slicer filters, providing a value equal to the sum of SalesAmount_USD for the column label value, as shown in Table 1.
However, if the column CalendarYear is used to slice the PivotTable, the results are different. Because CalendarYear is specified as the argument to ALLEXCEPT, when the data is sliced on the year, a filter will be applied on years at the row level, as shown in Table 2. The user is encouraged to compare these tables to understand the behavior of ALLEXCEPT().
It 's an amazing and awesome blog
ReplyDeletePower BI Course
Power BI Online Training