Practice Exams:

Microsoft PL-300: DAX Context Without the Confusion

DAX becomes much easier when “context” stops sounding like a hidden rule and starts looking like a set of filters that define what a calculation can see. Most surprising results in Power BI are not arithmetic mistakes. They come from a measure being evaluated under a filter context the author did not recognize, or from row context being confused with filter context inside an iterator or calculated column.

Microsoft describes row context as the current row and filter context as the filters applied to columns and propagated through relationships. Measures are evaluated in filter context. Iterators such as SUMX create row context as they walk a table. CALCULATE is important because it can modify filter context and, in specific situations, transition row context into filter context. Once those ideas are separated, many “mysterious” DAX behaviors become predictable.

This reasoning belongs in data platform engineering because a semantic model is code with a data shape. Candidates preparing for PL-300 need to read a measure in terms of model relationships, current filters, granularity, and evaluation context rather than memorizing functions in isolation.

Begin with filter context because visuals create it for you

Every visual establishes filter context. Put Year on columns, Product Category on rows, and a Sales measure in values, and each cell evaluates the measure under a different combination of filters. Slicers, page filters, report filters, cross-highlighting, drill state, and relationship propagation all contribute. The measure does not “know” which visual called it; it simply evaluates against the context it receives.

Use this as the default mental model: a measure answers a question about the rows currently visible to the calculation. SUM(Sales[Amount]) returns a different result by year because Year filters the Date dimension, the relationship propagates the allowed dates to Sales, and SUM sees only matching fact rows. There is no special annual version of the measure.

When a result looks wrong, inspect the filters before rewriting the formula. Ask which dimension values are active, which relationships propagate them, whether a visual introduced an unexpected grouping column, and whether any DAX inside the measure adds or removes filters.

Treat row context as a cursor, not a filter

Row context identifies a current row. Calculated columns have an implicit row context because they evaluate once for every row in their table. Iterator functions create row context while they step through the rows of a table expression. That lets an expression reference columns from the current row without aggregating them first.

Row context by itself does not filter an entire related fact table the way report filters do. This distinction is the source of many mistakes. If a calculated column on Customer references Customer[Region], the current row tells DAX which region value to read. If that expression needs the sum of Sales related to the current customer, the row context must somehow influence the filter context used by the aggregation.

This is where context transition becomes useful. Do not think of row context as a weaker version of filter context; they are different evaluation mechanisms that can coexist and interact.

Understand CALCULATE as a context operator

CALCULATE evaluates an expression in a modified filter context. A filter argument can add a new filter, replace an existing filter on the same column, preserve existing filters with KEEPFILTERS, remove filters with REMOVEFILTERS, activate an inactive relationship with USERELATIONSHIP, or change relationship behavior with CROSSFILTER. The power comes from controlling the context in which an ordinary expression is evaluated.

For example, a measure that returns sales for one product color is conceptually simple: calculate the existing sales measure under a Product Color filter. A percentage-of-total measure evaluates one expression under the current context and a second under a context where selected filters have been removed. The business logic is easier to reason about when the formula is described in context terms before it is described in function names.

Without filter arguments, CALCULATE can perform context transition. In a row context, it creates filter context from the current row so an aggregation can see the corresponding model rows. Microsoft notes that model measures invoked in row context receive this transition automatically, which is one reason measures behave differently from raw aggregation expressions inside iterators.

Let the star schema do the filtering work

Context is easier when the semantic model has clear dimensions and facts. A date dimension filters a sales fact. A product dimension filters the same fact. A customer dimension filters it as well. Measures can then rely on predictable one-to-many relationships instead of compensating for ambiguous tables with complex DAX. The companion star schema design article explains the model side of that relationship.

Bidirectional relationships can be useful, but they also make filter propagation harder to reason about. If filters can travel through several paths, a measure may receive context from tables the author did not expect. Prefer a simple star where dimensions filter facts in one direction unless a specific requirement justifies something more complex.

If a DAX measure requires repeated use of CROSSFILTER, TREATAS, or complicated filter repair just to answer routine questions, review the model before adding another layer of expression logic. The same principle appears in semantic model design: a clean model reduces the amount of context manipulation every measure has to perform.

Know when iterators change the evaluation shape

Functions such as SUMX, AVERAGEX, FILTER, and ADDCOLUMNS evaluate an expression for rows in a table. That means row context exists inside the iterator. The expression may also reference a measure, which is evaluated under filter context and can receive context transition. Understanding which part of the formula is a table expression and which part is a row-by-row scalar expression prevents many accidental calculations.

Use an iterator when the calculation genuinely requires row-level logic before aggregation, such as multiplying quantity by price for each line and then summing the results. Do not replace a simple SUM with SUMX merely because iterators feel more explicit. The simplest function that matches the required grain is usually easier for both the engine and the reader.

Variables help when an iterator contains several context-sensitive steps. Name the table being iterated, capture intermediate scalar values, and separate the part that defines the population from the part that calculates a result. Clear variable names often expose a context mistake before the formula runs.

Remove filters narrowly and intentionally

Total and share calculations frequently need to compare the current slice with a broader population. REMOVEFILTERS is useful because it makes that intent explicit. Remove the Product Category filter to get all categories while preserving Year and Region. Remove every filter on the fact table only if that is actually what the business definition requires.

ALL and related functions can also remove filters or return tables, but broad use can erase context that users expect the report to honor. A ratio that ignores date, geography, security scope, and scenario filters may be mathematically valid and analytically misleading. Name measures so the denominator is clear, and test them under slicers that were not present when the measure was first written.

The goal is not to make a formula “immune” to report context. The goal is to control exactly which filters matter to the business question.

Debug context by making it visible

When a measure behaves unexpectedly, create temporary diagnostic measures that expose selected values, row counts, or scope. Functions such as SELECTEDVALUE, VALUES, COUNTROWS, ISINSCOPE, and CONCATENATEX can reveal which dimension members are active at a point in the visual. A simple diagnostic often explains the result faster than adding more CALCULATE layers.

Test measures at several grains: a card, a matrix by date, a matrix by product, and a combined matrix. Check subtotal behavior. Many context bugs appear only when the visual introduces a higher-level total where there is no single current category. A formula written as if every cell has one selected value can fail at total rows even though detail rows look perfect.

Power BI expertise grows when modelers can predict the result before running the measure. The Power BI Data Analyst path rewards that skill because semantic modeling and DAX are connected: a measure is always evaluated inside the model the analyst designed.

Prefer readable DAX over clever DAX

Context-heavy formulas are maintenance code. Use variables, format expressions consistently, reuse trusted measures, and keep filter logic close to the business rule it represents. A future maintainer should be able to describe which filters are added, removed, or preserved without reverse-engineering nested functions.

Build a small base-measure layer such as Revenue, Quantity, Cost, and Margin, then compose higher-level calculations from those measures. This reduces repeated aggregation logic and makes context behavior consistent. It also makes testing easier because the same base measures are used across reports.

DAX context stops being confusing when you ask three questions in order: What filters does the model give me? Is there a row context because I am in a calculated column or iterator? What does CALCULATE change? That sequence is more durable than memorizing isolated examples and gives PL-300 candidates a practical way to reason about unfamiliar formulas.

Related Posts

• Claude Production Engineering

• Microsoft AI-103: Capacity Planning for Azure AI

• Microsoft AI-103: Testing AI Prompts on Azure

• Microsoft AB-100: Measuring Copilot Business Value

• Microsoft SC-500: Managed Identities and Least Privilege

• Amazon AWS AIP-C01: Testing GenAI Applications on AWS

• Anthropic CCAO-F: Claude on Vertex AI or Direct API?

• Microsoft AZ-104: Designing Recovery with Azure Backup

• Amazon AWS SCS-C03: Secrets Manager Rotation Patterns

• Cisco 200-301: Inter-VLAN Routing Design Choices