← Back to Blog

DAX CALCULATE Modifiers Cheat Sheet

A fast, scannable reference for the filter-modifying functions used inside CALCULATE — ALL, ALLEXCEPT, ALLSELECTED, REMOVEFILTERS, KEEPFILTERS, and USERELATIONSHIP.

DAXCheat Sheet

Quick reference for the functions you'll actually pass as filter arguments to CALCULATE(). See CALCULATE for the full explanation of how filter context modification works, and ALL, ALLEXCEPT, ALLSELECTED & REMOVEFILTERS for the deep dive on the filter-removal functions specifically.

Removing Filters

FunctionRemoves
ALL(Table)Every filter on the entire table
ALL(Table[Column])Filters on just that one column
ALLEXCEPT(Table, Column1, ...)Every filter on the table except the columns listed
REMOVEFILTERS(Table or Column)Same effect as ALL, with a name that says what it does
Total Sales (All Products) =
CALCULATE(
    [Total Sales],
    ALL(DimProduct)
)
Total Sales (All Products) =
CALCULATE(
    [Total Sales],
    REMOVEFILTERS(DimProduct)
)

ALL() and REMOVEFILTERS() do the same thing here — REMOVEFILTERS() exists purely for clarity of intent, and most style guides now prefer it for new code.

Keeping Only Some Filters

ALLEXCEPT() is the inverse of listing columns to remove — it clears everything on a table except the columns named.

Sales by Category Only =
CALCULATE(
    [Total Sales],
    ALLEXCEPT(DimProduct, DimProduct[Category])
)
Report filtered to: Category = Bikes, Color = Red, Size = Large
        |
ALLEXCEPT(DimProduct, DimProduct[Category]) keeps only Category
        |
Result: sales for all Bikes, ignoring Color and Size filters

Respecting User Selections Anyway

ALLSELECTED() removes filters from inside the visual's own context (like ALL()), but still respects filters coming from outside it — slicers, page filters, other visuals.

FunctionIgnoresStill respects
ALL(Table)Everything, including slicers and page filtersNothing
ALLSELECTED(Table)The visual's own row/column contextSlicers, page filters, report filters
Percent of Filtered Total =
DIVIDE(
    [Total Sales],
    CALCULATE([Total Sales], ALLSELECTED(DimProduct))
)

This is the function behind "percent of visible total" calculations that need to respect whatever a user has already filtered the page to, rather than always dividing by the true grand total.

Adding Instead of Replacing

By default, CALCULATE() replaces an existing filter on the same column. KEEPFILTERS() changes that to combine (AND) instead of overwrite.

Bike Sales =
CALCULATE(
    [Total Sales],
    KEEPFILTERS(DimProduct[Category] = "Bikes")
)
Without KEEPFILTERS: report filtered to Accessories -> CALCULATE overrides it -> shows Bikes
With KEEPFILTERS:    report filtered to Accessories -> combined with Bikes -> shows nothing (no overlap)

Reach for this specifically when a measure needs to intersect with the existing filter rather than override it.

Switching Which Relationship Is Used

Sales by Ship Date =
CALCULATE(
    [Total Sales],
    USERELATIONSHIP(FactSales[ShipDate], DimDate[Date])
)

Only one relationship between two tables can be active at a time. USERELATIONSHIP() temporarily activates a specific inactive one for the duration of the calculation — common when a fact table has multiple date columns (order date, ship date, due date) but only one relationship can drive the date table by default.

Quick Decision Table

NeedFunction
Ignore every filter on a tableALL(Table) or REMOVEFILTERS(Table)
Ignore filters on one specific columnALL(Table[Column])
Keep only certain columns' filtersALLEXCEPT(Table, Column, ...)
Ignore visual context but respect slicers/page filtersALLSELECTED(Table)
Combine a new filter with the existing one, not replace itKEEPFILTERS(...)
Use an inactive relationship for this calculationUSERELATIONSHIP(...)

Next Steps