Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

3.7 Row Context vs Filter Context

Lesson 28 of 62 in the free Power BI notes on Siksha Sarovar, written by Rohit Jangra.

Row Context vs Filter Context

Understanding evaluation context is the most important concept in DAX. It determines how DAX formulas are evaluated and what data they operate on.

What is Evaluation Context?

Evaluation context defines which rows of data a DAX expression sees when it is being calculated. There are two types:

1. Row Context

• Exists when DAX iterates over a table row by row • Each row is evaluated independently • Created automatically in calculated columns • Also created by iterator functions: SUMX, AVERAGEX, FILTER, MAXX, etc.

Example (Calculated Column):

Profit = Sales[Revenue] - Sales[Cost]

Here, DAX evaluates each row individually — [Revenue] and [Cost] refer to the values in the current row.

Example (Iterator):

Total Profit = SUMX(Sales, Sales[Revenue] - Sales[Cost])

SUMX creates a row context, evaluates Revenue - Cost for each row, then sums the results.

2. Filter Context

• Exists when external filters are applied to the data • Determines which rows are visible to the formula • Created by slicers, report filters, visual filters, and CALCULATE • Affects measures and aggregate functions

Example (Measure):

Total Sales = SUM(Sales[Amount])

If a slicer is set to "2024", this measure only sums Amount for rows where Year = 2024.

Key Differences

FeatureRow ContextFilter Context
When CreatedCalculated columns, iterator functionsSlicers, filters, CALCULATE
ScopeOne row at a timeEntire filtered table
ReferencesColumn values in current rowAggregated values across filtered rows
ExampleSales[Revenue] - Sales[Cost]SUM(Sales[Amount])
Automatic inCalculated columnsMeasures

Context Transition

What is Context Transition? When CALCULATE converts a row context into a filter context. This is a critical concept for intermediate DAX users.

How it Works: • Inside an iterator (SUMX, FILTER, etc.), there is row context • When a measure is called inside that iterator, CALCULATE wraps it • The row context values become filter conditions • This creates a new filter context for that specific row

Example:

Running Total =
SUMX(
    Dates,
    [Total Sales]  -- [Total Sales] measure triggers context transition
)

Common Mistakes

Expecting row context in measures — measures don't have row context by default • Ignoring filter context in calculated columns — calculated columns don't respond to slicers • Not understanding that CALCULATE modifies filter context — this is key to advanced DAX

Best Practice

• Use measures for dynamic calculations (they respond to filter context) • Use calculated columns only when you need row-level values or slicers • Always think: "What context will this formula evaluate in?"