Power BI

ALL vs ALLEXCEPT vs ALLSELECTED in DAX Power BI – Explained Simply with Examples

Introduction

When working in Power BI, understanding DAX filter functions can be a game-changer for building accurate and interactive reports. The functions ALL, ALLEXCEPT, and ALLSELECTED are three frequently used yet misinterpreted functions.
Although they sound similar, they behave differently when it comes to clearing or keeping filters.
In this article, we’ll break them down in simple words with clear examples so you can confidently use them in your reports.

WhatsApp Group Join Now
Telegram Group Join Now

1. What is ALL in DAX?

ALL removes all filters from the specified table or column.
It’s like telling Power BI: “Ignore any filters and show me everything.”

Syntax:

ALL ( [<tableNameOrColumnName>] )

Example:
Suppose you have this table:

ProductSales
A100
B200
C300

If a slicer filters to Product A, normally:

Total Sales = SUM(Sales[Amount])

would give 100.

But:

Total Sales ALL = CALCULATE(SUM(Sales[Amount]), ALL(Sales))

returns 600, ignoring the slicer.

Use Case:
Calculate grand totals or percentages that should not be affected by slicers or filters.


2. What is ALLEXCEPT in DAX?

ALLEXCEPT removes all filters except those you want to keep.
Think of it as saying: “Clear all filters, but keep this specific filter.”

Syntax:

ALLEXCEPT ( <table>, <column>[, <column>[, …]] )

Example:
Suppose you have:

ProductRegionSales
AEast100
AWest200
BEast300

If you want totals per product regardless of region filters:

Sales by Product = CALCULATE(SUM(Sales[Amount]), ALLEXCEPT(Sales, Sales[Product]))

Even if you filter Region to East, this still sums all regions for each product.

Use Case:
Group totals while ignoring other filters (e.g., keep Product filter, remove Region filter).


3. What is ALLSELECTED in DAX?

ALLSELECTED removes filters inside the visual but keeps outer context filters like slicers.
It’s comparable to stating: “Ignore the breakdown in this chart but respect the user’s selection elsewhere.”

Syntax:

ALLSELECTED ( [<tableNameOrColumnName>] )

Example:
You have a slicer selecting only Products A & B.
In a chart showing Product-wise sales, if you click on Product A, normal SUM would give just A’s value.

But:

Total Sales ALLSELECTED = CALCULATE(SUM(Sales[Amount]), ALLSELECTED(Sales[Product]))

returns total sales for both A & B from the slicer, ignoring the visual’s filter on just A.

Use Case:
Percentage of total based on slicer selection, useful for dynamic visuals.


Quick Comparison Table

FunctionClears Filters FromKeeps Specific Filters?Keeps Slicer Selections?Best For
ALLEverything❌ No❌ NoGrand totals ignoring all filters
ALLEXCEPTEverything except given columns✅ Yes❌ NoGroup totals with some filters kept
ALLSELECTEDVisual-level filters✅ Yes✅ Yes% of total within slicer selection

Conclusion

While ALL, ALLEXCEPT, and ALLSELECTED all deal with filters, they serve different purposes:

  • ALL – Ignores everything.
  • ALLEXCEPT – Ignores everything except what you choose.
  • ALLSELECTED – Ignores visual filters but keeps slicer context.

Mastering these functions will make your Power BI reports more interactive, dynamic, and accurate.


FAQs

  1. Which is faster, ALL or ALLEXCEPT?
    ALL is slightly simpler, but performance difference is negligible for small datasets.
  2. Can ALLSELECTED work without slicers?
    Yes, but it behaves similarly to ALL in that case.
  3. When should I avoid ALL?
    When you need user context in calculations—ALL will remove it entirely.
  4. Is ALLEXCEPT only for one column?
    No, you can keep multiple columns’ filters.
  5. Do these functions work in Excel Power Pivot?
    Yes, they are also available in Excel’s DAX environment.
WhatsApp Group Join Now
Telegram Group Join Now

Farook Mohammad

I have 2 years of experience in Data Analytics and share the latest job vacancies, practical knowledge, real-world projects, and interview questions in Excel, Python, Power BI, SQL, and MySQL to help learners and professionals grow in their careers.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button