Percent Of Total
Common DAX patterns for calculating percent of total, percent of parent, and percent of a specific category.
Percent Of Total
Percent of total shows how much a single row contributes to a larger whole.
Category | Sales | % of Total
----------|---------|------------
Bikes | 45,000 | 60%
Gear | 20,000 | 27%
Apparel | 10,000 | 13%The pattern always has the same shape: a filtered value, divided by an unfiltered (or less-filtered) value.
The Basic Pattern
Sales % of Total =
DIVIDE(
[Total Sales],
CALCULATE(
[Total Sales],
ALL(DimProduct)
)
)Sales % of Total
|
| =
|
[Total Sales] (filtered) / [Total Sales] (ALL — unfiltered)The numerator respects whatever filters are active. The denominator deliberately removes them, producing the grand total to divide by.
Anatomy of a percent of total
Evaluating the Tire B row of the visual
Numerator — the visual's filter, Product = Tire B, is left alone: $15K
2% of Total
ALL(DimProduct)
$15K ÷ $75K =
20%
3% of Category
ALLEXCEPT(DimProduct, DimProduct[Category])
$15K ÷ $45K =
33%
4No filter removed
CALCULATE([Total Sales])
$15K ÷ $15K =
100%
What the matrix visual shows
| Product | Sales | 2% of Total | 3% of Category | 4No filter removed |
|---|---|---|---|---|
| Tire A | $30K | 40% | 67% | 100% |
| Tire B | $15K | 20% | 33% | 100% |
| Bikes total | $45K | 60% | 100% | 100% |
| Helmet A | $12K | 16% | 60% | 100% |
| Helmet B | $8K | 11% | 40% | 100% |
| Gear total | $20K | 27% | 100% | 100% |
| Jersey A | $10K | 13% | 100% | 100% |
| Apparel total | $10K | 13% | 100% | 100% |
| Grand total | $75K | 100% | 100% | 100% |
Numerator — plain [Total Sales], evaluated in whatever context the visual row sets. Every variant shares it; only the denominator changes.
ALL(DimProduct) — removes every filter on the product table, so the denominator is the full $75K on every row. Category subtotals come out at the intro table's 60% / 27% / 13%.
ALLEXCEPT(…, Category) — removes the Product filter but keeps Category, so Tire B is divided by the Bikes total ($45K), not the grand total. Each category's products add up to 100%, and so does every subtotal row.
No filter removed — the page's "Dividing by a Filtered Denominator" mistake. The denominator sees the same filters as the numerator, so it's the same number, and every row shows 100%.
Percent of Grand Total
Using ALL() on the entire table produces a percentage against the true grand total, regardless of any other filters active in the report.
Sales % of Grand Total =
DIVIDE(
[Total Sales],
CALCULATE(
[Total Sales],
ALL(FactSales)
)
)Percent of Parent Category
Instead of comparing against the grand total, a row can be compared against just its own parent group.
Sales % of Category =
DIVIDE(
[Total Sales],
CALCULATE(
[Total Sales],
ALLEXCEPT(DimProduct, DimProduct[Category])
)
)Example output:
Category | Product | Sales | % of Category
---------|-----------|---------|----------------
Bikes | Tire A | 30,000 | 67%
Bikes | Tire B | 15,000 | 33%
Gear | Helmet A | 12,000 | 60%
Gear | Helmet B | 8,000 | 40%Each product's percentage is relative to its own category total, not the overall grand total.
Percent of a Fixed Selection
Sometimes the denominator should stay fixed to a specific value, regardless of what the user filters elsewhere in the report.
Sales % of West Region =
DIVIDE(
[Total Sales],
CALCULATE(
[Total Sales],
DimStore[Region] = "West"
)
)This always divides by West region sales specifically, even if the report is currently filtered to a different region.
Why DIVIDE() Instead of /
DIVIDE() handles division by zero gracefully, returning blank instead of an error.
Safe: DIVIDE([Total Sales], [Grand Total])
Risky: [Total Sales] / [Grand Total]If the denominator is ever zero — an empty category, a filter with no matching rows — the plain / operator returns an error that can break visuals. DIVIDE() avoids that entirely.
Formatting as a Percentage
The measure itself returns a decimal (0.60, not "60%"). Formatting is applied separately.
Raw value: 0.60
|
| percentage formatting
|
Displayed: 60%Set from the measure's Format property in the Modeling ribbon, choosing Percentage.
Best Practices
- Always use
DIVIDE(), never the raw/operator, for percentage measures. - Be explicit in the measure name about what the percentage is relative to (total, category, region, and so on).
- Reuse the base measure (
[Total Sales]) instead of repeating the aggregation logic in both numerator and denominator. - Set number formatting to Percentage so the measure doesn't display as a raw decimal.
Common Mistakes
Dividing by a Filtered Denominator
Forgetting to remove filters from the denominator (with ALL() or ALLEXCEPT()) makes the denominator match the numerator, and every row shows 100%.
Using / Instead of DIVIDE()
The raw division operator errors on divide-by-zero, which can silently break an otherwise-working visual whenever a filter combination produces an empty group.
Forgetting Percentage Formatting
A correct measure that returns 0.6 but isn't formatted as a percentage displays as a confusing raw decimal instead of "60%".
Percent of Total Checklist
Before publishing a percent-of-total measure:
DIVIDE()is used, not the/operator.- The denominator's filter removal matches what "total" should mean for this measure (grand total, category, or a fixed selection).
- The measure name makes clear what the percentage is relative to.
- The measure is formatted as a percentage, not a raw decimal.
Next Steps
Continue exploring DAX patterns:
- Totals
- Ranking
- Running Total
- Earned Value Management (EVM) Metrics
- Risk Score & Heat Map
- Coverage & Verification
- Reliability Metrics (MTBF, MTTR & Availability)
- ALL, ALLEXCEPT, ALLSELECTED & REMOVEFILTERS
Fast reference for these and the other CALCULATE modifiers: DAX CALCULATE Modifiers Cheat Sheet.
- DIVIDE — the safe-division function every percent-of-total measure should be built on.