What is Context in Power BI?

Cody Schneider8 min read

DAX formulas in Power BI are incredibly powerful, but they can sometimes feel like a moving target. The same measure can return different values depending on where you use it in your report - in a card, a table, or a chart. This isn't a bug, it's a core feature of the Power BI engine called "context," and understanding it is the most important step toward becoming a confident Power BI user. In this tutorial, we’ll break down exactly what context is, the different types you'll encounter, and how you can manage it to build insightful and accurate reports.

What is Context in Power BI? A Simple Analogy

Before jumping into the technical terms, let's use a real-world analogy. Imagine you're at your favorite coffee shop. Your final bill is calculated with a simple formula: Total Price = Price per Item x Quantity. This formula is your DAX measure.

"Context" is simply where you're looking when you apply that formula.

  • If you look at the entire order on your receipt, the context is "all items." The total is calculated for every latte, croissant, and muffin combined.
  • If you point to just the "lattes" line item on the receipt, the context is now "only lattes." The formula is calculated just for the price and quantity of the lattes.
  • If you group items by category ("Drinks" and "Food"), the context for the "Drinks" subtotal includes all the lattes and other beverages, but not the food items.

The formula never changed a single letter. What changed was its environment - the data it was allowed to "see" when it ran its calculation. That, in a nutshell, is context in Power BI.

The Two Pillars of Context: Row and Filter

In the world of DAX, context is primarily divided into two types: row context and filter context. They often work together, but they are fundamentally different concepts. Grasping this distinction is crucial for understanding why your formulas behave the way they do.

Understanding Row Context: The "Row-by-Row" Calculator

Row context exists when a DAX formula is iterating through a table, one row at a time. It only considers the data in the single row it's currently focused on. Think of it as putting on blinders that only let you see one line of your data at a time to perform a calculation.

Where you find it: Row context is most commonly created in calculated columns. It is also created implicitly by certain DAX functions called "iterators," like SUMX(), AVERAGEX(), and FILTER().

Example: Calculated Column

Let's say we have a simple Sales table with the following data:

If you create a new calculated column with this formula, you're creating a row context:

LineTotal = 'Sales'[Unit Price] * 'Sales'[Quantity]

For the first row, Power BI looks only at that row and calculates 1200 * 5 = 6000. It doesn't know anything about the 'Keyboard' or 'Monitor' rows. Then it moves to the second row and calculates 75 * 10 = 750. It completes this process for every single row in the table. The result is 'pasted' as a new static column in your data model.

Example: Using an Iterator Function (SUMX)

You can also create a temporary row context within a measure using an iterator function. The 'X' at the end of functions like SUMX or AVERAGEX signals that they are iterators.

Total Sales with SUMX = 
  SUMX(
      'Sales',
      'Sales'[Unit Price] * 'Sales'[Quantity]
  )

Here, SUMX does the following:

  1. It looks at the table you provided ('Sales').
  2. It creates a row context and goes to the first row to perform the imaginary LineTotal calculation (1200 * 5 = 6000).
  3. It stores that result (6000) in memory.
  4. It repeats this for every single row in the table (750, 2800).
  5. Finally, after iterating through every row, it adds up all the results it stored in memory and returns the final sum (6000 + 750 + 2800 = 9550).

The key takeaway is that row context forces DAX to evaluate a formula on a granular, row-by-row basis.

Understanding Filter Context: The Slicers and Dials of Your Report

Filter context is the set of active filters being applied to your data model at any given moment. This is what makes Power BI reports feel interactive. It is not about iterating through rows, but about filtering the entire data model before a calculation is even made.

Where you find it: Filter context is created by:

  • Slicers and Filters Pane: When a user selects "2023" in a year slicer, that adds a filter to the entire context.
  • Visuals: The rows, columns, axes, or legends of charts and tables automatically apply filters.
  • DAX formulas: Advanced functions like CALCULATE() can directly manipulate the filter context.

Example: Measures in a Visual

Let's create a very simple measure: a sum of the LineTotal column we made earlier.

Total Sales = SUM('Sales'[LineTotal])

Now, let's see how filter context affects the result of this measure:

  1. In a Card Visual: If you place this measure in a card, there are no filters applied by the visual itself. The card shows the grand total for the whole table: 9550. The initial filter context is "all data."
  2. In a Table Visual: If you create a table visual with 'Product' on the rows and the [Total Sales] measure in the values, Power BI does something brilliant.

The measure's formula SUM('Sales'[LineTotal]) never changed. The filter context created by the visual dynamically changed the subset of data the measure was allowed to see, giving you the correct result for each product without any extra work.

When Worlds Collide: Context Transition

The most advanced and powerful behavior in DAX happens when row context and filter context interact. This process is called context transition.

In short, context transition takes the current row from a row context and transforms it into an equivalent filter context.

Let's revisit our calculated column. What if we tried to create a calculated column to show the percentage of each line item's total sales against the grand total? A beginner might try something like this:

% of Total (Wrong) = 'Sales'[LineTotal] / SUM('Sales'[LineTotal])

This won't work as expected. The result in every row will be 100%. Why? Because the SUM('Sales'[LineTotal]) part is also being evaluated inside the row context. It can only see its own row's LineTotal value, so it divides the number by itself.

This is where context transition saves the day. It most often happens when you use the CALCULATE() function. CALCULATE modifies the existing filter context and is the superhero of DAX.

Let's make a correct version by invoking our [Total Sales] measure inside an iterator, which has a row context:

% of Grand Total = 'Sales'[LineTotal] / CALCULATE( [Total Sales], ALL('Sales') )

In this formula:

  • 'Sales'[LineTotal] operates under the existing row context (it knows the value for the specific row).
  • CALCULATE( [Total Sales], ALL('Sales') ) does two things. First, the ALL('Sales') function tells Power BI to remove any existing filters on the Sales table to ensure we always get the grand total. The magic is that CALCULATE triggers context transition, turning the existing row context into a filter context. While ALL('Sales') overrides that filter in this instance, using CALCULATE is what allows us to escape the current row context and see the entire table.

Quick Tips for Mastering Context in DAX

This can seem complex, but keeping a few rules of thumb in mind can help you troubleshoot almost any DAX issue:

  • Calculated columns have row context. They are calculated once during data refresh and don't respond to user slicers. They are best for static values based only on data within that row.
  • Measures respond to filter context. They are calculated on-the-fly and react to what the user is clicking on. Use them for nearly all aggregations in your reports.
  • Iterators (SUMX, AVERAGEX, FILTER) create row context. They allow you to go line-by-line within a measure, but use them wisely as they can be slower than simple aggregations.
  • CALCULATE() is your master key. It's the primary tool for manipulating filter context - adding, removing, or changing filters - and triggers context transition.
  • Ask "What's my context?" When a formula breaks, stop and ask yourself: "In what context is this calculation running? Is it row-by-row? What filters are being applied by my visual and my slicers?"

Final Thoughts

Understanding the difference between row and filter context is the biggest conceptual hurdle in moving from a beginner to an intermediate Power BI user. Row context works row-by-row inside your tables, primarily for calculated columns. Filter context works by filtering your entire data model and is what makes your dashboard visuals dynamic. Learning how they interact via context transition opens up a world of powerful and precise analytics.

If climbing the DAX learning curve feels intimidating, you're not alone. We created Graphed because we believe getting insights from your data shouldn't require months of training. You can connect your marketing and sales data sources in just a few clicks and simply describe the dashboard you want in plain conversational language. We build real-time reports and handle all the behind-the-scenes complexity, so you can spend less time writing formulas and more time acting on clear, actionable insights.

Related Articles

How to Connect Facebook to Google Data Studio: The Complete Guide for 2026

Connecting Facebook Ads to Google Data Studio (now called Looker Studio) has become essential for digital marketers who want to create comprehensive, visually appealing reports that go beyond the basic analytics provided by Facebook's native Ads Manager. If you're struggling with fragmented reporting across multiple platforms or spending too much time manually exporting data, this guide will show you exactly how to streamline your Facebook advertising analytics.

Appsflyer vs Mixpanel​: Complete 2026 Comparison Guide

The difference between AppsFlyer and Mixpanel isn't just about features—it's about understanding two fundamentally different approaches to data that can make or break your growth strategy. One tracks how users find you, the other reveals what they do once they arrive. Most companies need insights from both worlds, but knowing where to start can save you months of implementation headaches and thousands in wasted budget.