We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Context in DAX

Context is one of the most important concepts in DAX. It determines how a DAX expression is evaluated and which rows are included in the calculation.

There are two types of context you must understand: Row Context and Filter Context.

  • Row context tells DAX "evaluate this row."
  • Filter context tells DAX "evaluate these filtered rows."

Row Context in DAX

Row context exists when DAX evaluates a formula for each row of a table. You get row context in DAX when you:

  • Create a calculated column
  • Use iterators like SUMX, AVERAGEX, MINX, MAXX
  • Use ADDCOLUMNS

Example in a calculated column:

Revenue Column = sales[sale_quantity] * RELATED(products[product_list_price])

DAX evaluates this expression for each individual row. No slicers or visuals can change this value, because row context is created at model-processing time.

Row context = DAX evaluating expressions row-by-row.

Filter Context in DAX

Filter context exists when DAX evaluates a measure using only the rows allowed by filters.

Filter context is created by:

  • Visual filters
  • Slicers
  • Page/report/visual-level filters
  • Relationship filtering between tables
  • The CALCULATE function (which can modify filter context)

Example measure:

Total Quantity = SUM(sales[sale_quantity])

When DAX runs this measure, it applies all active filters – from visuals, slicers, relationships, CALCULATE, etc. Then it sums the Quantity column only for the rows in the filtered set.

Filter context = DAX evaluating expressions using the currently filtered rows.

Assignment

    • The Total Revenue measure changes
    • The Total units sold measure changes
    • The Customer average age does not change (customers don't relate directly to dates)
    • The revenue in February date-constrained-aggregate measure does not change
    • The session quality score iterator measure does not change

Save the project and, from the course directory, submit the CLI tests.

Remove the date box to filter after you successfully pass the tests. We don't need or want it anymore.