10.2A condition or a table as an argument

You are going to write many filters in CALCULATE. They can be written as a condition or as a table. The two look alike, but do not always give the same result.

10.2.1A condition is a table

A condition like Customers[City] = "New York" is only a shorthand. Power BI reads it as a table of the values kept, built from all the cities:

CALCULATE( [Revenue], Customers[City] = "New York" )
Power BI accepts this DAX foryes, Measureyes, Calculated columnno, Calculated tableno, Virtual table
CALCULATE( [Revenue], FILTER( ALL( Customers[City] ), Customers[City] = "New York" ) )
Power BI accepts this DAX foryes, Measureyes, Calculated columnno, Calculated tableno, Virtual table

The two formulas are equivalent. ALL provides all the cities, regardless of the filter of the row. FILTER keeps New York. CALCULATE replaces the city filter with this one-row table. That is why the filter of the row is replaced.

This one-row table amounts to writing the filter Customers[City] IN { "New York" }. With a broader condition, FILTER keeps several cities. FILTER( ALL( Customers[City] ), Customers[City] <> "Toronto" ) keeps New York and Chicago, and amounts to writing Customers[City] IN { "New York", "Chicago" }.

The rest of this lesson is part of izyDAX Pro

You have just read the first section. The next 2, their animations, the exercises and the summary are waiting for you with izyDAX Pro, in a single payment.