Power BI: DAX Filter Functions Compared
Power BI
3. Juni 2026 04:02

Power BI: DAX Filter Functions Compared

von HubSite 365 über SQLBI

Microsoft expert guide to DAX filter removal: ALL ALLSELECTED ALLEXCEPT REMOVEFILTERS in Power BI and Excel

Key insights

  • Purpose and scope: The four DAX functions ALL, ALLSELECTED, ALLEXCEPT, and REMOVEFILTERS control the filter context that Power BI uses to decide what data a measure can "see", especially for totals, percentages, and running calculations.
  • Core behaviors: ALL can return a table or remove filters; ALLSELECTED keeps outer selections (like slicers) while ignoring inner visual filters; ALLEXCEPT removes all filters on a table except the listed columns; REMOVEFILTERS only clears filters and does not return a table.
  • When to use REMOVEFILTERS vs ALL: Prefer REMOVEFILTERS inside CALCULATE when you only want to clear filters. Use ALL when you specifically need a table result or the table-returning behavior.
  • Caveats and ambiguity: ALL is multifunctional and can confuse users because it changes meaning by context; REMOVEFILTERS avoids that ambiguity but cannot replace functions that must return a table or mimic ALLSELECTED/ALLEXCEPT behavior.
  • How to pick between ALLSELECTED and ALLEXCEPT: Use ALLSELECTED for visual totals that should respect slicer or external selections; use ALLEXCEPT when you want to clear every filter except one or more grouping columns.
  • Practical rule of thumb: Use REMOVEFILTERS for simple filter clearing, use ALL when you need table semantics, use ALLSELECTED for slicer-aware visuals, and use ALLEXCEPT to preserve specific grouping columns—there is no single replacement for all cases.

Overview of the video

The YouTube video by SQLBI explains the differences between four DAX functions that remove filters from the filter context: ALL, ALLSELECTED, ALLEXCEPT and REMOVEFILTERS. The presenter emphasizes that these functions look similar but behave differently in important ways, especially when used inside CALCULATE. As a result, the video aims to clear common misconceptions and provide practical guidance for report authors and modelers.

The update highlighted in the video is that REMOVEFILTERS should be the preferred choice when the only goal is to clear filters inside CALCULATE. At the same time, the presenter warns that ALL, ALLSELECTED and ALLEXCEPT still matter because they do not share identical semantics with REMOVEFILTERS. Therefore, viewers are encouraged to understand the differences rather than swap functions blindly.

Core differences explained

First, the video clarifies that ALL has two meanings: it can either return a table or act as a filter modifier in CALCULATE, which creates confusion. Conversely, REMOVEFILTERS only clears filters and never returns a table, so it avoids that ambiguity when used only to remove filters. This distinction matters because some calculations require a table result while others need only to change the filter context.

The presenter then contrasts ALLSELECTED and ALLEXCEPT with the simpler behaviors of the other two functions. ALLSELECTED preserves external slicer or page selections while ignoring inner visual-level filters, which makes it useful for visual totals but conceptually tricky. Meanwhile, ALLEXCEPT clears all filters on a table except those on specified columns, a behavior that cannot be fully mimicked by REMOVEFILTERS as a CALCULATE modifier.

When to use each function

The video offers clear rules of thumb. Use REMOVEFILTERS when you only need to clear filters inside CALCULATE and you do not need a table result, because it makes your intent explicit and reduces ambiguity. By contrast, use ALL when you need the function to return a table or when the table-returning form of ALL is necessary for the expression to work correctly.

For scenarios where totals must respect user slicer selections but ignore visual filters, the presenter recommends ALLSELECTED. When you want to clear every filter except for a few grouping columns, use ALLEXCEPT. Thus, selecting the right function depends on whether you need a table, whether you want to respect external selections, and which columns must remain filtered.

Tradeoffs and practical challenges

One tradeoff discussed is clarity versus flexibility. REMOVEFILTERS improves clarity by separating filter removal from table operations, yet it cannot replace the table-returning behavior of ALL when that behavior is required. Consequently, changing existing measures to REMOVEFILTERS may simplify intent but could break logic that depends on a table object, so teams must test conversions carefully.

The video also highlights conceptual complexity as a challenge, especially with ALLSELECTED. Because it mixes the idea of a shadow filter context with filter removal, many users misapply it and end up with unexpected totals or percentages. Moreover, performance can be an issue when functions interact with large tables or complex relationships, so developers must measure and optimize where necessary.

Practical tips and best practices

The presenter recommends naming conventions and comments to make intent explicit in measures, which helps other authors understand whether the code relies on a table result or simply clears filters. In addition, the video suggests testing measure behavior at different granularity levels and with various slicer states to ensure results match expectations. These steps reduce surprises when reports are used by business users.

Finally, the guidance advises keeping a small set of patterns for common scenarios: use REMOVEFILTERS for straightforward filter clearing, keep ALL when a table result is needed, apply ALLSELECTED for slicer-aware totals, and choose ALLEXCEPT for group-preserving exceptions. By balancing clarity, correctness and performance, report authors can achieve predictable results and easier maintenance.

Related links

Power BI - Power BI: DAX Filter Functions Compared

Keywords

ALL vs ALLSELECTED DAX, ALLEXCEPT vs REMOVEFILTERS Power BI, DAX ALL vs ALLEXCEPT vs ALLSELECTED, REMOVEFILTERS vs ALLSELECTED DAX, Power BI DAX filter functions comparison, DAX ALLSELECTED examples, ALLEXCEPT usage in DAX, REMOVEFILTERS best practices DAX