CALCULATE filters
Change the question, not the data
CALCULATE lets a scalar calculation answer a different question by temporarily changing its filters. The report and underlying rows are not modified. For instance, a Home revenue measure may ignore a Stationery selection on the category column while still respecting North. Use the clean Import model from Chapter 20. FactSales has five lines, RevenueUSD and Quantity; DimProduct contains ProductKey, Product and Category; DimRegion contains Region. Active one-to-many relationships filter the fact from each dimension. Use dimension columns for selections, no RLS, no other report filters, and fixed USD. Reuse the existing [Context Revenue] measure (SUM(FactSales[RevenueUSD])). Every formula below is a separate measure unless identified as a query or column. Expected results are fixture-derived; native DAX execution is NOT RUN.
Example 1 — Replace a category filter
Home Revenue =CALCULATE([Context Revenue], DimProduct[Category] = "Home")Select North using DimRegion[Region] and Stationery using DimProduct[Category]. The ordinary measure returns 24 (L01); Home Revenue returns 30 (L02). The new restriction targets exactly the category column, so North remains. With South instead of North the forced Home result is 60. With no filters Home revenue is 90. If the user also filters Product to Notebook, the Home result is BLANK: replacing Category does not remove a separate Product restriction.
Example 2 — Filter fact rows by a business rule
Large Line Revenue =CALCULATE([Context Revenue], FILTER(FactSales, FactSales[Quantity] >= 2))Without filters, L01, L03 and L05 qualify: 24 + 36 + 60 = 120 USD. Under North only L01 qualifies: 24 USD. FILTER examines the already visible fact rows, returning a table; CALCULATE uses that table as a filter. A narrower Boolean form for this simple rule is CALCULATE([Context Revenue], KEEPFILTERS(FactSales[Quantity] >= 2)) (next lesson). Avoid casually filtering entire fact tables: their related columns and expanded-table behavior can affect more than intended. The examples have no additional quantity filter.
Filter arguments and evaluation boundaries
The first argument supplies a scalar expression. Additional arguments may be Boolean predicates, tables, or modifiers. For ordinary Boolean predicates, use columns from one table, not measures or nested CALCULATE; table-scanning expressions have restrictions. Separate predicates on distinct columns can combine. Prefer a narrow column predicate when it expresses the rule. Do not treat arguments as sequential commands or expect the first filter argument to alter the input to the second. A nested CALCULATE can intentionally create a different outer context. Context-transition details follow in lesson 3.
Practice — inspect the remaining rows
Predict the normal and forced Home revenue for South with a Travel category selection; then select Product = Backpack as well. Explain which filter is replaced and which remains. Record row IDs as well as scalar values.