Percent of Total in DAX with ALLSELECTED
Percent of total measures usually DIVIDE a value by a CALCULATE that clears the inner grouping with ALLSELECTED (or ALL / REMOVEFILTERS) — ALLSELECTED is the usual match for “percent of what this visual currently shows”.
Chala mitrano! “What share is Mumbai of what I’m looking at?” is the real question. Why? ALL and ALLSELECTED answer different denominators. How? We build a City % with ALLSELECTED, format it, and contrast ALL on FreshBasket (fictional). This is the payoff after the ALL family guide.
Quick answer
Vertical % pattern:
- Numerator:
[Total Sales](respects the row). - Denominator:
CALCULATE ( [Total Sales], ALLSELECTED ( Customer[City] ) ). - Wrap with
DIVIDE ( … ). - Format as percentage.
- Matrix rows should add near 100% for the visual selection.
- Compare ALL when you truly want “percent of all cities forever”.
DIVIDE (
[Total Sales],
CALCULATE ( [Total Sales], ALLSELECTED ( Customer[City] ) )
)
Why % of total, rows in / number out
| City | Total Sales |
|---|---|
| Mumbai | 140 |
| Nashik | 80 |
- Why: managers ask for share, not only rupees.
- Mumbai row numerator = 140.
- ALLSELECTED clears the City filter from the row but keeps outer slicers/visual selection. Denominator = 220.
DIVIDE ( 140, 220 )≈ 63.6%.- Nashik =
DIVIDE ( 80, 220 )≈ 36.4%. Shares add to 100%. - If a Region slicer removed other cities, ALLSELECTED’s denominator follows what you still see. ALL may reach outside that set.
Percent of visual total: numerator respects the row; denominator uses CALCULATE ( …, ALLSELECTED ( … ) ).
मित्रांनो — Percent of visual total: numerator respects the row; denominator uses CALCULATE ( …, ALLSELECTED ( … ) ).
मित्रों — Percent of visual total: numerator respects the row; denominator uses CALCULATE ( …, ALLSELECTED ( … ) ).
What do I need before this guide?
- ALL family and DIVIDE.
- Course: ALL / ALLSELECTED.
Before and after (look at the tables first)
Before
आधी (Before)
पहले (Before)
After
नंतर (After)
बाद में (After)
The pattern
Pct of Selected Cities =
DIVIDE (
[Total Sales],
CALCULATE (
[Total Sales],
ALLSELECTED ( Customer[City] )
)
)
- Row City stays in the numerator.
- ALLSELECTED clears the City column filter from the row while respecting outer slicers/visuals.
- Adjust names to your model.
What readers expect
Readers expect each row’s % to add toward the total of what the visual currently shows (outer slicers kept).
मित्रांनो — Readers expect each row’s % to add toward the total of what the visual currently shows (outer slicers kept).
मित्रों — Readers expect each row’s % to add toward the total of what the visual currently shows (outer slicers kept).
- Percents should relate to the visual’s current total.
- Outer Region slicer usually should still apply.
- Title the visual “% of selected cities”.
Shop analogy: Mumbai’s share of today’s open tills on the screen — not always share of every city that ever existed in the database.
ALLSELECTED vs ALL
ALL clears broadly; ALLSELECTED respects outer/visual selections — pick the denominator that matches the question.
मित्रांनो — ALL clears broadly; ALLSELECTED respects outer/visual selections — pick the denominator that matches the question.
मित्रों — ALL clears broadly; ALLSELECTED respects outer/visual selections — pick the denominator that matches the question.
- ALLSELECTED → percent of the selected/visual set.
- ALL → percent of the whole column/table universe (more aggressive clear).
- Pick the denominator that matches the sentence you would say aloud.
Mistakes and calm fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| Always 100% | Cleared nothing useful | ALLSELECTED on the right column |
| Ignores Region slicer | Used ALL too broadly | Prefer ALLSELECTED |
| Blank | DIVIDE by zero | Empty selection; check filters |
| Adds to 87% | Filters / missing rows | Expected if not all rows shown |
Ghabru naka 😅 — 100% everywhere means numerator equals denominator, not “maths is broken”.
Ravindra Bagale's Tip
Interview trap: “ALL vs ALLSELECTED for % of total?” Calm answer: “ALLSELECTED respects outer visual selections; ALL clears more broadly. I match the function to the business sentence.” Got it?
Ravindra Bagale's Tip – मराठी
Interview trap: “% of total साठी ALL vs ALLSELECTED?” शांत उत्तर: “ALLSELECTED outer visual selections चा आदर करते; ALL जास्त broadly clear करते. मी function business sentence शी match करतो.” समजलं का?
Ravindra Bagale's Tip – हिंदी
Interview trap: “% of total के लिए ALL vs ALLSELECTED?” शांत जवाब: “ALLSELECTED outer visual selections का सम्मान करता है; ALL ज़्यादा broadly clear करता है. मैं function को business sentence से match करता हूँ.” समझ में आया?
Practice task
- Build Pct of Selected Cities.
- City matrix + % column (Mumbai ≈ 64% on the two-city sample).
- Add Region slicer; compare ALLSELECTED vs ALL denominators.
- Format as % and retitle the visual.
- Write the business sentence your denominator implements.
Got it? % of total = DIVIDE + CALCULATE; ALLSELECTED for “what I see”. Next: inactive relationships. Let's continue.
समजलं का? % of total = DIVIDE + CALCULATE; ALLSELECTED for “what I see”. Next: inactive relationships. Aata pudhe jaauya.
समझ में आया? % of total = DIVIDE + CALCULATE; ALLSELECTED for “what I see”. Next: inactive relationships. आगे बढ़ते हैं.
Frequently asked questions
Why ALLSELECTED?
It builds a denominator that respects outer/visual selections while clearing the inner grouping you are percenting over.
ALL vs ALLSELECTED?
ALL clears more aggressively; ALLSELECTED is usually what readers mean by “percent of what I see”.
Always 100%?
Numerator and denominator identical — wrong column cleared, or only one row.
REMOVEFILTERS instead?
Useful for “% of all cities ignoring slicer”; different business question.
Multiple columns?
Percent of total can use ALLSELECTED on a table or columns — start with one column.
Course lesson?
ALL / ALLSELECTED lesson in the DAX chapter.