Row Context vs Filter Context

Power BI · DAX (Data Analysis Expressions)

Theory

DAX evaluates every expression inside an evaluation context, and there are two kinds. Row context means 'the current row': it exists in calculated columns and inside iterators such as SUMX, so an expression like Sales[Qty] * Sales[Amount] can read the values of that one row. Row context does not filter other tables or rows by itself.

Filter context is the set of filters active when a measure is evaluated: the row and column headers of the visual, slicers, page and report filters, and filters added by CALCULATE. For the cell 'North' in a table visual, the filter context is Region = North, so SUM(Sales[Amount]) sees only North's three rows and returns ₹3,200. A common mistake is writing SUM(Sales[Amount]) in a calculated column and expecting a per-row value: there is no filter context per row, so every row gets the grand total, ₹6,200, unless context transition is used.

Why we use it

These two contexts explain almost every 'why is my DAX wrong?' question. Once you know which context you are in, results stop being surprising.

When to use it

Think row context when writing calculated columns and iterator expressions; think filter context when writing measures for visuals. Use CALCULATE when you need to change the filter context or turn row context into filter context.

How it works

  1. DAX expression is evaluated
  2. Is there a current row (column or iterator)? Yes: Column references read that row's values. No: Column references need an aggregation.
  3. Apply the filter context from visual, slicers and CALCULATE
  4. Aggregate the visible rows
  5. Return the value

Syntax

Row context: created by calculated columns and iterators (SUMX, AVERAGEX, FILTER, ADDCOLUMNS…)
  Sales[Line] = Sales[Qty] * RELATED(Products[Price])
Filter context: created by visuals, slicers, filters and CALCULATE
  Total Sales = SUM(Sales[Amount])

Example

// Row context: one value per Sales row (calculated column)
Unit Price = DIVIDE(Sales[Amount], Sales[Qty])   // 101 → 600, 103 → 500

// Filter context: one value per visual cell (measure)
Total Sales = SUM(Sales[Amount])                  // North → 3,200

// Pitfall: calculated column Bad Total = SUM(Sales[Amount]) → 6,200 on every row

Key points

Power BI topics

Power BI Introduction

Getting Data

Power Query (Data Transformation)

Data Modeling

DAX (Data Analysis Expressions)

Data Visualization

Dashboards & Reports

Power BI Service

Advanced Features

Projects & Case Studies

Interview & Certification

Advanced DAX & Time Intelligence

T
Tech Town
Log InSign Up Free
Home SQL Python DSA Power BI Snowflake Databricks Spark Gen AI Practice Problems Contest Blog

Power BI Dashboards & DAX

Learn data visualization and interactive dashboards step-by-step. Click any topic in the sidebar to open it right here.

{{ sectionCount }}
Sections
{{ topicCount }}
Topics
Free
Forever
Hands-on practice Practice DAX Online 250 business scenarios on a star schema — write a measure and compare your visual with the expected one. Start practising →
Section {{ sec.num }}

{{ sec.label }}

Power BI  /  {{ current.sectionLabel }}  /  {{ current.name }}

{{ current.name }}

Theory

{{ current.def }}

Why we use it

{{ rich.why }}

When to use it

{{ rich.when }}

Diagram

{{ rich.dg.caption }}

{{ tb.title }}
{{ c.v }}
{{ rich.dg.op }}
➜
{{ rich.dg.output.title }}
{{ c.v }}
{{ nd.label }}
{{ nd.sub }}
{{ nd.label }}
{{ nd.sub }}
{{ rich.dg.left.title }}
{{ it }}
{{ rich.dg.right.title }}
{{ it }}
On screen — where to click

{{ rich.ui.title }}

{{ u.text }}
  1. {{ st.n }}{{ st.text }}
{{ rich.ui.title }}
{{ u.text }}
Flowchart — how it works
{{ nd.text }}
{{ nd.text }}
◇ {{ nd.text }}
Yes → {{ nd.yes }}
No → {{ nd.no }}
Syntax / Where to find it
{{ current.syntax }}
Example
{{ current.example }}
What You'll Learn — click to check off
  • {{ pt.mark }} {{ pt.text }}

Share this topic