Home Tutorials Power BI Tutorial DAX Context
DAX Context

DAX Context


Row Context vs. Filter Context

Description: Understanding "Context" is the single most important milestone in mastering DAX. In Power BI, context determines exactly which data is included in a calculation at any given moment. There are two primary types: Row Context and Filter Context.

Why: Beginners often get frustrated when their formulas don't return the expected numbers. Usually, this is because they are using a calculation designed for Row Context inside a Filter Context, or vice versa. Mastering these allows you to create dynamic, high-performance reports.


1. Row Context (The "Current Row")

Row Context is the concept of "looking at a single line." When you create a Calculated Column, DAX iterates through the table one row at a time to perform the math. It only knows about the values in the specific row it is currently processing.

  • Where it lives: Calculated Columns and "Iterator" functions (like SUMX or FILTER).
  • Example: If you create a column Profit = [Sales] - [Cost], DAX calculates this for Row 1, then Row 2, then Row 3, independently.

2. Filter Context (The "Report View")

Filter Context is the set of filters applied to the data before the calculation happens. It is driven by the user's interaction with the report. When you look at a Measure in a chart, the value you see is the result of all active filters combined.

  • Where it lives: Measures and visuals (Charts, Tables, Cards).
  • What defines it: Slicers, the "Filters" pane, clicking on other visuals (cross-filtering), and the rows/columns of a matrix.

Comparison Summary

Feature Row Context Filter Context
Perspective Individual record level. Aggregated (Grouped) level.
Dynamic? No. Values are fixed until the next refresh. Yes! Changes instantly when a user clicks a slicer.
Primary Use Calculating data for every specific row. Calculating summaries (Totals, Averages).

Example: The Total Sales Test

Imagine a report with a Slicer for the year 2026:

  • A Calculated Column for Total Sales would still show the sales for every year in the underlying table view.
  • A Measure for Total Sales displayed in a Card visual would instantly drop from "All Time" sales to only show 2026 sales because the Filter Context changed.

Key Notes

  • Context Transition: You can turn Row Context into Filter Context by using the CALCULATE() function. This is an advanced technique used to make row-level data interact with report-level filters.
  • Performance: Because Filter Context is calculated on-demand, it is generally much faster and more memory-efficient than creating hundreds of calculated columns using Row Context.
  • Visual Interactions: Remember that every visual on your page acts as a filter for the others. Clicking a bar in a chart creates a new Filter Context for every other visual on the report page.

🏋️ Test Yourself With Exercises

Take our quiz on DAX Context to test your knowledge.

Browse Quizzes »