DAX in Power BI for Data Science & Analytics

ALL, REMOVEFILTERS and Context Control

Learn how DAX controls filter context when you need a calculation to ignore a particular filter or compare a filtered value with a broader total.

8

Interactive investigations

CONTEXT

Filter control

8

Related knowledge checks

Lesson Progress13%

Learning Path

CONTEXT INVESTIGATION 1

Why Context Control Matters

In Power BI, a measure can be evaluated under many filters at the same time. Sometimes you need the calculation to respect those filters. Sometimes you need part of the calculation to ignore one of them.

Current Context

Region = North

₹183K

→

Context Control

REMOVEFILTERS(Region)

→

Broader Context

₹564K

Context Detective

What is the purpose of removing a filter from a calculation?

ALL and REMOVEFILTERS in DAX

ALL and REMOVEFILTERS are important DAX functions for controlling filter context in Power BI. They are commonly used when a measure needs to compare a filtered value with a broader total.

REMOVEFILTERS in DAX

REMOVEFILTERS can explicitly remove filters from specified columns or tables during a calculation. For example, a denominator can remove the Region filter so that a regional value can be compared with the total across regions.

CALCULATE(
  [Total Sales],
  REMOVEFILTERS(Sales[Region])
)

Percentage of Total in Power BI

A percentage-of-total calculation generally needs a numerator that represents the current selection and a denominator representing the desired broader comparison context.

What You Learn in This Lesson

  • • Why filter context sometimes needs to be controlled
  • • Using ALL to remove filters
  • • Using REMOVEFILTERS for explicit context control
  • • Column-level filter removal
  • • Percentage-of-total calculations
  • • Context simulation
  • • Debugging incorrect DAX context
  • • Regional business analysis