(+351) 21 24 10006  ·  info@bconcepts.pt
Carnaxide, Lisbon

PL-300: how to master DAX measures and aggregations

João Barros 01 de August de 2026 6 min read

I will teach the skill of creating DAX measures and using aggregations in Power BI — a core ability in Model the data (PL-300). Well-defined measures and correct aggregations are crucial for accurate reports, performance, and dynamic analysis in dashboards. This skill is not just syntax: it involves thinking about context, performance, and validation with real data.

What you need to know

Measures are dynamic calculations in DAX that return a single value per filter context. Unlike calculated columns, measures are evaluated when you render a visualization, so they adapt to the context (filters, slicers, rows/columns in matrices). Grouping and aggregating data (SUM, AVERAGE, COUNT, DISTINCTCOUNT) is part of the measures work.

Think of them as functions that respond to the report environment: if you apply a year slicer, the same measure adjusts; if you put the measure in a matrix by product, it calculates per product. In datasets with 100k–5M rows, using measures instead of calculated columns reduces disk space and improves refresh and query speed. Typical examples: total revenue, weighted average margin, percent of total, and year-over-year comparisons.

Practical example: you have a Sales table with Quantity and Price columns. If you need total revenue, you don’t create a fixed column for each row (although you could); the ideal is to create a measure:

Revenue = SUMX(Sales, Sales[Quantity] * Sales[Price])

This measure automatically responds to date, region, or product filters and, in tests with 1M rows, returns results in under a second on a machine with sufficient memory (VertiPaq). For scenarios with line-level discounts you can extend the expression to Sales[Discount] or use a separate price table and do a lookup with RELATED/LOOKUPVALUE depending on the model.

How it works

Conceptually, measures operate over the filter context. Three essential ideas:

  • Filter context — the set of filters applied (slicers, hierarchies, relationships). For example, if a user selects 2024 and North Region, the measure sees only those rows.
  • Row context — when you use iterator functions like SUMX, each row of the iterated table defines the context for that iteration; SUMX will evaluate the expression for each row and then sum the results.
  • Deferred evaluation — a measure is calculated when the visualization requests it, not automatically for each table row, which allows dynamic calculations and lower space usage.

Practical syntax examples (you can paste these into Power BI Desktop):

Revenue = SUMX(Sales, Sales[Quantity] * Sales[Price])

Total Units = SUM(Sales[Quantity])

Average Price = AVERAGE(Sales[Price])

Unique Customers = DISTINCTCOUNT(Sales[CustomerID])

Revenue YoY =
VAR Current = [Revenue]
VAR Prior = CALCULATE([Revenue], DATEADD(Date[Date], -1, YEAR))
RETURN
DIVIDE(Current - Prior, Prior)

Note: DATEADD requires a continuous date table. In models with 10 years of data, these functions allow accurate period comparisons.

In practice

Step-by-step to create effective measures:

  1. Understand the requirement: do you want total, weighted average, unique count, percent of total, temporal comparison? Document the expected behavior with numerical examples (e.g., "Category share for January = €23,450").
  2. Choose the correct function: SUM/AVERAGE/COUNT/DISTINCTCOUNT for simple aggregations; SUMX for aggregation with a per-row expression; CALCULATE to change the filter context (for example, ignore filters or apply additional filters).
  3. Use VAR for clarity: storing intermediate results makes the measure more readable and avoids unnecessary re-evaluations — useful in complex measures with 4–6 intermediate steps.
  4. Handle divisions by zero: use DIVIDE(x, y) instead of x / y to avoid errors when y = 0; DIVIDE also allows specifying an alternate result.
  5. Validate in the visual: add the measure to tables/matrices and validate with filters to confirm expected behavior; test with 5–10 scenarios (years, categories, regions).

Example: percent of total by category

Category Revenue % =
DIVIDE(
    [Revenue],
    CALCULATE([Revenue], ALL(Products[Category]))
)

This measure calculates each category’s share of revenue compared to the global total, ignoring the category filter (thanks to ALL). If the global total is €2,000,000 and a category generates €250,000, the measure returns 0.125 (12.5%).

Common mistakes

  • Using calculated columns when you should use measures — columns store values per row; measures are dynamic and more efficient for contextual aggregations. In datasets with >1M rows, extra columns can increase the model by tens of MB.
  • Ignoring filter context — measures can return unexpected results if you don’t consider slicers, relationships, or ALL/REMOVEFILTERS. Always test with different filters and combinations.
  • Using iterator functions unnecessarily — using SUMX when a SUM would suffice can penalize performance; SUM is executed more efficiently by the VertiPaq engine.
  • Not using VAR — repeating complex calculations makes the engine re-evaluate the same expression multiple times, which can degrade performance.

How to practice

Practice in Power BI Desktop with the sample dataset (e.g., Contoso or Financials). Create measures for revenues, margins, weighted averages, and temporal comparisons. Concrete examples: calculate gross margin per product, a weighted average price per unit sold, and a quarterly growth indicator. For exam-oriented evaluation, use the OFFICIAL and free Microsoft Practice Assessment and consult the official study guide — both are free and provide guidance on the skills measured. Do not use or rely on brain dumps; always follow official material to prepare correctly.

In summary

  • DAX measures are dynamic calculations evaluated in the filter context; they are essential for correct reports.
  • Use SUMX for row-by-row calculations, CALCULATE to change context, VAR for readability, and DIVIDE for safe divisions.
  • Test measures with different filters and visuals to validate behavior; document test scenarios with numerical examples.
  • Practice with sample datasets and consult the official Practice Assessment and study guide from Microsoft.