KB 100502
Filtered table as filter argument (single column predicate over ALL table rows)
A FILTER function filtering ALL the rows of an entire table with a single column predicate is used as a filter argument in functions such as CALCULATE, CALCULATETABLE, etc.
Remarks
The single column predicate can be applied as a filter argument without filtering an entire table.
In order to keep the same semantics as the original filter, apply REMOVEFILTERS on the previously iterated table because the iterator was over ALL of that table.
Recommended articles:
Example
Remove the Date iterator and add REMOVEFILTERS on Date so that the filter context is removed from all the other columns of the Date table to keep the original semantics once the condition only filters Date[Year].
Original code
CALCULATE (
[Sales Amount],
FILTER (
ALL ( 'Date' ),
'Date'[Year] = 2023
)
)
Possible optimization
CALCULATE (
[Sales Amount],
REMOVEFILTERS ( 'Date' ),
'Date'[Year] = 2023
)