Ravindra BagaleCourses & study guides Track your progress

Guides

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:

  1. Numerator: [Total Sales] (respects the row).
  2. Denominator: CALCULATE ( [Total Sales], ALLSELECTED ( Customer[City] ) ).
  3. Wrap with DIVIDE ( … ).
  4. Format as percentage.
  5. Matrix rows should add near 100% for the visual selection.
  6. 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
  1. Why: managers ask for share, not only rupees.
  2. Mumbai row numerator = 140.
  3. ALLSELECTED clears the City filter from the row but keeps outer slicers/visual selection. Denominator = 220.
  4. DIVIDE ( 140, 220 ) ≈ 63.6%.
  5. Nashik = DIVIDE ( 80, 220 ) ≈ 36.4%. Shares add to 100%.
  6. If a Region slicer removed other cities, ALLSELECTED’s denominator follows what you still see. ALL may reach outside that set.
Percent with ALLSELECTED Denominator uses ALLSELECTED so outer slicers still count. Numerator CALCULATE +ALLSELECTED % pct

Percent of visual total: numerator respects the row; denominator uses CALCULATE ( …, ALLSELECTED ( … ) ).

What do I need before this guide?

Before and after (look at the tables first)

Before percent of total Absolute city sales only.

Before

After percent of total City shares of selected total.

After

The pattern

Pct of Selected Cities =
DIVIDE (
    [Total Sales],
    CALCULATE (
        [Total Sales],
        ALLSELECTED ( Customer[City] )
    )
)
  1. Row City stays in the numerator.
  2. ALLSELECTED clears the City column filter from the row while respecting outer slicers/visuals.
  3. Adjust names to your model.

What readers expect

Percent of visual total Row value divided by the total of what the visual currently shows. City row 12% of visual Visual total 100% visual

Readers expect each row’s % to add toward the total of what the visual currently shows (outer slicers kept).

  1. Percents should relate to the visual’s current total.
  2. Outer Region slicer usually should still apply.
  3. 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

ALLSELECTED vs ALL ALL ignores more filters; ALLSELECTED respects outer visual selections. ALLclears broadly ALLSELECTEDkeeps outer picks pick

ALL clears broadly; ALLSELECTED respects outer/visual selections — pick the denominator that matches the question.

  1. ALLSELECTED → percent of the selected/visual set.
  2. ALL → percent of the whole column/table universe (more aggressive clear).
  3. 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?

Practice task

  1. Build Pct of Selected Cities.
  2. City matrix + % column (Mumbai ≈ 64% on the two-city sample).
  3. Add Region slicer; compare ALLSELECTED vs ALL denominators.
  4. Format as % and retitle the visual.
  5. Write the business sentence your denominator implements.

Learn it properly

Course lessons:

Related guides: ALL family · USERELATIONSHIP

Got it? % of total = DIVIDE + CALCULATE; ALLSELECTED for “what I see”. Next: inactive relationships. Let's continue.

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.