Totals
Common DAX patterns for calculating totals, grand totals, and totals that ignore filters.
Totals
"Total" sounds simple, but DAX offers several different kinds depending on which filters should — and shouldn't — apply.
Total
|
+-- Filtered total (respects slicers/filters)
|
+-- Grand total (ignores row-level filters)
|
+-- Total ignoring one specific filterLooking for why a table's total row doesn't equal the sum of its rows? That's a different problem: see Power BI totals don't add up.
Basic Total
A simple SUM() respects whatever filter context is currently active.
Total Sales =
SUM(FactSales[SalesAmount])In a table visual grouped by Category, this measure automatically returns the total for each category, because the visual applies a filter per row.
Grand Total (Ignoring All Filters)
ALL() removes filters from a table or column, producing a true grand total regardless of the current selection.
Grand Total Sales =
CALCULATE(
[Total Sales],
ALL(FactSales)
)Every row in a table visual using this measure shows the same overall total, ignoring the row's own category.
Percent of Grand Total
Combining a filtered total with a grand total produces a percentage of the whole.
Sales % of Total =
DIVIDE(
[Total Sales],
[Grand Total Sales]
)Each row shows its own share of the overall total — see Percent of Total for a closer look at this pattern.
Total Ignoring One Specific Filter
ALL() can target a single column instead of an entire table, removing just that filter while keeping others active.
Sales Ignoring Region =
CALCULATE(
[Total Sales],
ALL(DimStore[Region])
)This keeps filters like Category or Date active, while ignoring whatever Region is currently selected.
Total Within a Group, Ignoring Sub-Filters
ALLEXCEPT() removes the filters on a table's columns except the ones listed, useful for a subtotal that should stay fixed within a larger group.
Sales Within Category =
CALCULATE(
[Total Sales],
ALLEXCEPT(DimProduct, DimProduct[Category])
)This ignores filters on every DimProduct column except Category, producing a total for the whole category regardless of which specific product row is being evaluated.
Two things it doesn't do. It only keeps a Category filter that already exists: with only Product on the rows and no Category in the visual or a slicer, there's no Category filter to keep, and every row shows the total for all products. And it only touches DimProduct, so filters on other tables, such as a Region slicer, still apply.
Comparing the Patterns
| Pattern | Function | Result |
|---|---|---|
| Basic total | SUM() | Respects all active filters |
| Grand total | ALL(FactSales) | Ignores every filter, including slicers on related dimension tables |
| Total ignoring one column | ALL(column) | Ignores just that filter |
| Total within a group | ALLEXCEPT() | Ignores that table's filters except the listed columns; other tables' filters still apply |
Anatomy of four totals
One table visual with Category and Product columns, and a slicer set to Region = West. Sales in $K; the East numbers exist but the slicer hides them.
| Category | Product | SalesTotal Sales | GrandGrand | No regionNo region | CategoryCategory |
|---|---|---|---|---|---|
| Bikes | Road Bike · Bikes | $30K | $125K | $50K | $45K |
| Bikes | Mountain Bike · Bikes | $15K | $125K | $40K | $45K |
| Gear | Helmet · Gear | $8K | $125K | $14K | $12K |
| Gear | Lock · Gear | $4K | $125K | $6K | $12K |
| Apparel | Jersey · Apparel | $10K | $125K | $15K | $10K |
| Total | $67K | $125K | $125K | $67K |
On the highlighted Mountain Bike row, which filters survive each measure?
| Measure | RegionRegion = Westfrom the slicer | ProductProduct = Mountain Bikefrom the row | CategoryCategory = Bikesfrom the row | Result |
|---|---|---|---|---|
| 1SalesSUM only | ✓kept | ✓kept | ✓kept | $15K |
| 2GrandALL(FactSales) | ✗removed | ✗removed | ✗removed | $125K |
| 3No regionALL(DimStore[Region]) | ✗removed | ✓kept | ✓kept | $40K |
| 4CategoryALLEXCEPT(DimProduct, DimProduct[Category]) | ✓kept | ✗removed | ✓kept | $45K |
Total Sales — every filter applies: Mountain Bike in the West, $15K. The total row drops the product filter but keeps the slicer: $67K.
ALL(FactSales) — removing filters from the fact table removes them from the dimensions it's related to as well, so the slicer is ignored too: $125K on every row, East included. Fine for a true grand total; wrong if "% of West" was the goal.
ALL(DimStore[Region]) — only the slicer goes: Mountain Bike across both regions, $15K + $25K = $40K.
ALLEXCEPT(DimProduct, Category) — the product filter goes, the Category filter from the row stays, and the slicer is on another table, so it stays too: all Bikes in the West, $45K. ALLEXCEPT only keeps a filter that already exists. Take Category out of the visual and there's nothing to keep: every row would show the West total, $67K, the same as the total row.
Example Output
Category | Sales | % of Total
----------|---------|------------
Bikes | 45,000 | 60%
Gear | 20,000 | 27%
Apparel | 10,000 | 13%
Total | 75,000 | 100%The % of Total column comes from dividing each row's filtered total by the unfiltered grand total.
Best Practices
- Reuse a base measure (like
[Total Sales]) insideCALCULATE()rather than repeating the sameSUM()expression everywhere. - Prefer
ALLEXCEPT()over listing multipleALL()calls when a subtotal needs to ignore several columns except one or two. - Be explicit about which filters a "total" should ignore — an unlabeled measure named
Totalcan mean different things to different people. - Test totals measures inside a table visual with grouping, not just as a single card, to confirm the filter behavior is correct.
Common Mistakes
Confusing SUM() with a Grand Total
A plain SUM() still respects the current filter context. Without ALL(), it is not a grand total — it's just the total for whatever is currently selected.
Removing Too Many Filters
Using ALL(FactSales) when only one column's filter needed to be ignored removes every filter on that table, which can silently produce a much bigger number than intended.
Dividing by Zero
Sales % of Total using plain division doesn't error when the grand total is zero: it returns Infinity (or NaN for 0 / 0), which shows up as "Infinity" or "NaN" in a visual. Use DIVIDE(), which returns blank instead by default.
Totals Checklist
Before publishing totals-related measures:
- Grand total measures explicitly use
ALL()orALLEXCEPT(), not justSUM(). - Percentage measures use
DIVIDE(), not the/operator. - Measure names make clear what kind of total they represent.
- Totals have been tested inside a grouped table, not just a single card visual.
Next Steps
Continue exploring DAX patterns:
- Why totals don't add up: when the total row isn't the sum of the rows, and the SUMX fix
- Ranking
- Percent of Total
- Running Total
- Earned Value Management (EVM) Metrics
- Risk Score & Heat Map
- Coverage & Verification
- Reliability Metrics (MTBF, MTTR & Availability)
- ALL, ALLEXCEPT, ALLSELECTED & REMOVEFILTERS