Data AnalyticsDAX measures and analytical correctness

ALL versus ALLSELECTED in a share-of-total measure

PK
Pankit Kumar
Sr. Data Scientist at Parexel (a Goldman Sachs–backed company) · 20 September 2026 · 3 min read
Technically reviewed by Ishaan Sharma
In this article (7 sections)

A share-of-total measure is defined as much by its denominator as its numerator. Decide whether a category's share should be measured against every category or only the categories included in the reader's selection. ALL and ALLSELECTED can support different filter-context choices, but neither function name tells the reader which question you intended.

Use an explicit field scope and test the denominator under slicers and matrix rows. Broadly removing every model filter can also erase the period or other business context you meant to retain.

Set up a controlled category selection

Build the retail lab model and its Paid Net Paise measure. Across all supplied dates, Software is 39,000, Training 23,500 and Support 7,000, totaling 69,500 paise.

Create a matrix with DimProduct[Category] on rows and a slicer using that same Category field. Select Software and Training only. The selected-category total is 62,500, while the all-category total remains 69,500 under no other filters.

Define an all-category denominator

dax
Paid Share All Categories =
DIVIDE(
    [Paid Net Paise],
    CALCULATE([Paid Net Paise], ALL(DimProduct[Category]))
)

In this simple model context, the denominator removes the Category column's filtering, including the slicer restriction. Software's share is 39,000/69,500, approximately 56.12%; Training's is approximately 33.81%.

The two selected rows sum to less than 100% because Support remains part of the denominator. That is correct for the all-category question.

Microsoft documents ALL and its filter-context considerations in the function reference. Additional filters on other product columns can affect the effective population; do not generalize this one-column example to every model without testing.

Define a selected-category denominator

dax
Paid Share Selected Categories =
DIVIDE(
    [Paid Net Paise],
    CALCULATE([Paid Net Paise], ALLSELECTED(DimProduct[Category]))
)

For the described matrix and slicer, the denominator retains the selected Software-and-Training population while removing the individual matrix row's category restriction. Software becomes 39,000/62,500 = 62.4%; Training becomes 37.6%.

Those selected-category shares sum to 100%. This does not make them more correct than the previous measure; they answer a narrower denominator question. See ALLSELECTED documentation for its query-context behaviour.

Preserve the date question

Select January as well. Paid Software is 29,000 and Training 18,500, totaling 47,500. Support has no January Paid activity, so both denominator policies happen to produce the same total in this fixture for that period.

That equality can hide a configuration mistake. Test February or the full supplied history too, where Support has Paid value and the denominators differ.

Avoid using ALL() with no field scope merely to make a percentage “work.” Removing date context would turn a share of the selected period into a share of broader history, which needs a different label and business justification.

Inspect total rows and additional filters

The matrix total for selected-category share should represent the selected total divided by itself under the described context. The all-category-share total represents the selected categories' combined value divided by all-category value.

Add a filter on ProductName or another product attribute and inspect the actual denominator. Removing Category alone does not necessarily remove every product restriction. Multi-column filters and the model's query behaviour can make informal “ignore filters” explanations misleading.

Do not describe ALLSELECTED as simply “whatever is visible on the screen” in every nested calculation. Its semantics relate to query and external filter context, so more complex iterators deserve dedicated tests.

Expose the denominator during development

Create temporary denominator measures and display them beside the shares. Expected full-history values in this test are 69,500 and 62,500. Seeing those numbers makes it much easier to identify the wrong filter scope than inspecting percentages alone.

The fixture verifies source values independently; DAX evaluation under the actual matrix and slicer remains an application-review step.

Exercise: select Software alone, then Software plus Support. Predict both denominators and shares before checking Power BI. Write labels that distinguish “share of all categories” from “share of selected categories” without requiring readers to know DAX.

NeuraPath's Data Analytics with Generative AI course connects filter-context techniques with clear business measures. A trustworthy share calculation makes the denominator policy visible and testable.

Continue learning

This article is part of the DAX measures and analytical correctness sequence. Use the neighbouring tasks when you need the prerequisite or the next application.

PK
Pankit Kumar
Lead Instructor, NeuraPath Academy

Pankit Kumar has 10 years in Data Science & AI, building and shipping production systems in regulated pharma and clinical environments. He is a freelance trainer at Boston Institute of Analytics, AnalytixLabs and Scaler, and has taught this material to thousands of working professionals.

This article is part of our Data Analytics with Generative AI programme — 3–4 months. The full analyst stack — Excel, SQL, Power BI and Python pipelines — then a generative-AI layer you can prove is right.

Explore Data Analytics with Generative AI
Counselling is free · no obligation

Not sure which programme fits?

Tell us your background and we will map it to the right entry point — including saying so when a cheaper programme is the better fit. A counsellor replies within one working day.