pbPassingBI
/
DAX calculations advanced 7 min

FILTER, ALL and ALLEXCEPT

Removing and replacing filter context deliberately.

What you'll be able to do
  • Use ALL to remove filters
  • Use ALLEXCEPT to keep some
  • Know when FILTER is needed over a simple condition

ALL

ALL removes filters from a table or column, which is how you compute a denominator that does not shrink with the selection:

% of Total =
DIVIDE(
    [Total Sales],
    CALCULATE([Total Sales], ALL('Product'))
)

Without ALL, the denominator is filtered exactly like the numerator and every row shows 100%.

ALL('Product'[Category]) removes filters from that column only, leaving the rest of the table filtered — which is usually what you want for a percent-of-category.

ALLSELECTED

% of Visible Total =
DIVIDE([Total Sales], CALCULATE([Total Sales], ALLSELECTED()))

ALL ignores everything including slicers. ALLSELECTED respects what the user has selected but ignores the row context within the visual.

So on a report filtered to 2024, ALL gives a percentage of all time and ALLSELECTED gives a percentage of 2024 — usually the one people actually mean.

ALLEXCEPT

Region Total =
CALCULATE([Total Sales], ALLEXCEPT('Sales', 'Sales'[Region]))

Removes every filter from the table except the columns you name. That gives each row its region's total while ignoring product, date and everything else — the denominator for a percent-of-region.

It is the inverse of listing everything you want to remove, and far more robust as the model grows.

FILTER

CALCULATE accepts simple conditions directly:

CALCULATE([Total Sales], 'Product'[Category] = "Bikes")

FILTER is needed when the condition involves a measure or must be evaluated row by row:

CALCULATE([Total Sales], FILTER('Product', [Total Sales] > 10000))
FILTER iterates

FILTER evaluates row by row over the table you give it. FILTER('Sales', ...) on a ten-million-row fact table is slow; FILTER('Product', ...) on a small dimension is not.

Always filter the smallest table that answers the question, and prefer a plain condition where one will do.

Key points
  • ALL ignores everything; ALLSELECTED respects the user selection
  • ALLEXCEPT removes all filters except the columns you name
  • FILTER iterates — apply it to the smallest table possible
Check yourself