DAX ALL & ALLEXCEPT: Remove Filters for Advanced Calculations

DAX ALL & ALLEXCEPT: Remove Filters for Advanced Calculations
Understand how the DAX ALL and ALLEXCEPT functions work in Power Pivot with simple examples. This tutorial explains how to remove filters, keep specific filters, calculate grand totals, create percentage-of-total formulas, and control filter context in Excel Power Pivot. Ideal for Excel users, analysts, finance teams, and Power Pivot learners who want to build more flexible and accurate DAX calculations.

A PivotTable filters your data. A slicer narrows it further. Most DAX measures respect those filters automatically — that is precisely the point of filter context. However, some calculations need to deliberately ignore one or more filters. ALL removes every filter from a table or column. ALLEXCEPT removes all filters except the ones you name. Together, these two functions power percentage-of-total and ranking calculations that need a fixed denominator regardless of the user’s current filter state.

This guide covers how ALL and ALLEXCEPT work. It also explains the dual-context behaviour and six practical examples: market share, percentage of grand total, category-level percentages, rank inside a filtered view, cumulative Pareto share, and a variance-from-company-average measure.

Key distinction: ALL and ALLEXCEPT behave differently depending on where you use them. Inside CALCULATE, they act as filter removers. Used standalone inside SUMX or FILTER, they return the full unfiltered table. Understanding this dual behaviour is essential.

How Do ALL and ALLEXCEPT Work?

ALL(TableOrColumn) returns all rows of a table or all distinct values of a column. Importantly, it ignores any active filters completely. When used as a CALCULATE argument, ALL removes that filter before evaluating the expression. ALLEXCEPT(Table, Column1...) works similarly but preserves the specified columns’ filters. All other filters on the table are then removed.

FunctionAs CALCULATE argumentAs standalone expression
ALL(Table)Removes all filters on the tableReturns the full unfiltered table
ALL(Table[Col])Removes filter on that column onlyReturns all distinct column values
ALLEXCEPT(T, C1)Removes all filters except C1Returns table with only C1 filter kept
ALLSELECTED(T)Removes row filters, keeps slicer contextReturns rows visible in current visual
Use ALLSELECTED for user-scoped totals: When users want the percentage of what they currently see — not the full dataset — use ALLSELECTED instead of ALL. It respects outer slicer context while removing row-level filters. This makes "% of filtered total" work correctly when slicers are active.

The Core Percentage-of-Total Pattern

The most fundamental ALL pattern divides the current filtered value by the grand total. CALCULATE with ALL removes the row context filter. Consequently, the denominator is always the full dataset total. The percentages therefore add up to 100% across all PivotTable rows.

Grand total percentage: this row's Sales as % of ALL sales. % of Grand Total := DIVIDE( [Total Sales], CALCULATE([Total Sales], ALL(Sales)) ) ALL(Sales) removes every filter on the Sales table. Denominator is always the full dataset total. DIVIDE handles zero denominators gracefully.

Examples 1–4: ALL and ALLEXCEPT in Practice

1
% of grand total — each region’s share of all sales

Each region row should show its share of company-wide revenue. The filter context applies the Region filter automatically. ALL(Sales) in the denominator removes that filter, so the denominator is always the full total — identical for every row.

Region
Revenue
% of Total
North
88,500
29.2%
South
62,300
20.6%
East
100,100
33.0%
% of Grand Total := DIVIDE([Total Sales], CALCULATE([Total Sales], ALL(Sales)))
2
% of category total — ALLEXCEPT keeps the Product filter

When a PivotTable shows Region and Product together, the percentage denominator should be the total for that product across all regions — not the grand total. ALLEXCEPT removes the Region filter while keeping the Product filter. Specifically, the denominator changes per product row.

% of Product Total := DIVIDE( [Total Sales], CALCULATE([Total Sales], ALLEXCEPT(Sales, Sales[Product])) ) North/Widget A = 28400/88400 = 32.1% South/Widget A = 22100/88400 = 25.0% (same Widget A denominator)
3
Rank in filtered view — ALLSELECTED for slicer-aware ranking

RANKX alone ranks against all table rows. ALLSELECTED makes RANKX rank only against the currently visible rows after slicers are applied. Additionally, the rank updates in real time when the slicer changes. This is therefore the correct approach for interactive report ranking.

SalesRank := RANKX(ALLSELECTED(Sales[Region]), [Total Sales]) With slicer showing 4 of 8 regions: ranks 1 to 4 (not 1 to 8).
4
Cumulative % — Pareto running share of total

A Pareto chart needs a running cumulative percentage. This measure ranks all products by sales, sums all products at or above the current rank, then divides by the ALL grand total. Specifically, it shows which products together account for 80% of revenue.

Cumulative % := VAR CurRank = RANKX(ALL(Sales[Product]), [Total Sales]) VAR CumAmt = CALCULATE([Total Sales], FILTER(ALL(Sales[Product]), RANKX(ALL(Sales[Product]), [Total Sales]) <= CurRank)) VAR Total = CALCULATE([Total Sales], ALL(Sales)) RETURN DIVIDE(CumAmt, Total)

Examples 5–6: Column-Level ALL and Variance Measures

5
ALL on a single column — ignore date filter, keep region

ALL applied to one column removes only that column’s filter. ALL(Sales[Date]) removes date slicers while keeping Region and Product filters. This creates a full-year reference metric that appears alongside the current-period value in the same row for easy comparison.

All-Date Sales := CALCULATE([Total Sales], ALL(Sales[Date])) Q1 North active: Total Sales = 42,000. All-Date Sales = 180,500 (full year North).
6
Variance from company average — each region vs the ALL average

Each region’s average order value compared to the company-wide average is a useful performance metric. ALL in the denominator removes the row filter. Consequently, the company average is stable and identical across every PivotTable row.

Variance vs Avg := VAR RegionAvg = AVERAGE(Sales[Amount]) VAR CompanyAvg = CALCULATE(AVERAGE(Sales[Amount]), ALL(Sales)) RETURN RegionAvg - CompanyAvg North: +8.67 (above average). East: -8.60 (below average).

Common Issues and How to Fix Them

The measure still changes with the slicer despite using ALL

Check which table or column you passed to ALL. ALL(Sales[Region]) removes only the Region filter — other active filters still apply. To remove all filters on the table, use ALL(Sales) without a column argument. Alternatively, list every column you want to remove filters from individually.

The percentages do not add up to 100%

The denominator is likely recalculating per row instead of holding a constant total. Verify that you are using ALL(Sales) — not ALL(Sales[Region]) — in the denominator. Also check that you are using DIVIDE rather than a raw division. DIVIDE returns blank for zero denominators, which can cause the total row to display incorrectly.

Frequently Asked Questions

  • What does ALL do in DAX?+
    ALL removes filters from a table or column. Inside CALCULATE, it evaluates the expression with those filters removed. CALCULATE([Total Sales], ALL(Sales)) returns the grand total regardless of any active filter. Used standalone inside FILTER or SUMX, ALL returns the full unfiltered table for iteration.
  • What is the difference between ALL and ALLEXCEPT?+
    ALL removes all filters from the specified table or column. ALLEXCEPT removes all filters except those on the columns you list. ALLEXCEPT(Sales, Sales[Product]) removes every filter on Sales except Product. Use ALLEXCEPT when the denominator should vary per category instead of being the absolute grand total.
  • What is ALLSELECTED and when should I use it?+
    ALLSELECTED removes row-level filters inside a visual while preserving outer slicer and cross-filter context. Use it when percentage or rank should reflect the user’s current filtered view. If a user filters to three regions using a slicer, ALLSELECTED makes those three regions sum to 100% instead of calculating against all eight in the model.
  • Can ALL be used outside of CALCULATE?+
    Yes. ALL(Table) or ALL(Table[Column]) returns an unfiltered table or column list usable inside FILTER or SUMX. FILTER(ALL(Sales[Product]), ...) iterates all products regardless of active filters. This differs from the CALCULATE-argument usage — as a CALCULATE argument, ALL modifies filter context; as a table expression, it provides unfiltered data for iteration.