By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
(For Power BI Developers & PL-300 Exam Prep)
DAX (Data Analysis Expressions) is Power BI’s formula language—think of it as Excel on steroids, but for relational data models. If you’ve ever: - Built a report that "just won’t calculate right" (e.g., sales totals ignoring filters, incorrect YoY growth), - Struggled with time intelligence (e.g., "Why does my MTD measure show the same as YTD?"), - Inherited a messy Power BI file where measures return nonsense when slicers change,
…then DAX is your lifeline.
Real-world scenario:You’re handed a Power BI report where: - A "Total Sales" measure works in a table but breaks when a user filters by region.- A "Prior Year Sales" measure returns blank for some months.- A "Top 5 Products" table shows duplicates because the data model has no relationships.
Without DAX, you’re stuck with static aggregations or manual Excel fixes. With DAX, you control how filters propagate, override context, and dynamically reshape data—without touching the source.
SUM
SUM(Sales[Amount])
CALCULATE
ALL
CALCULATE(SUM(Sales[Amount]), ALL(Sales))
Sales
FILTER(Sales, Sales[Amount] > 1000)
FILTER
CALCULATE(SUM(Sales[Amount]), Sales[Amount] > 1000)
ALL(Sales)
RELATED(Product[Category])
RELATED
LOOKUPVALUE
Date
ProductID
Amount
Region
Products
Category
Cost
Sales[ProductID]
Products[ProductID]
Total Sales = SUM(Sales[Amount])
Total Sales
Sales % of Total = DIVIDE( [Total Sales], CALCULATE([Total Sales], ALL(Sales)) )
CALCULATE([Total Sales], ALL(Sales))
DIVIDE
% of Total
Sales PY = CALCULATE( [Total Sales], SAMEPERIODLASTYEAR(Sales[Date]) )
SAMEPERIODLASTYEAR
[Total Sales]
[Sales PY]
Top 5 Products = VAR TopProducts = TOPN( 5, SUMMARIZE( Sales, Products[ProductName], "Profit", SUM(Sales[Amount]) - SUM(Products[Cost]) ), [Profit] ) RETURN CONCATENATEX( TopProducts, Products[ProductName] & ": $" & FORMAT([Profit], "0"), UNICHAR(10) )
SUMMARIZE
ProductName
Profit
TOPN(5, ..., [Profit])
CONCATENATEX
[Top 5 Products]
// ✅ Fast (columnar) CALCULATE(SUM(Sales[Amount]), Sales[Amount] > 1000) `` - UseSUMMARIZEsparingly: It’s slow—preferGROUPBYorSUMMARIZECOLUMNS` for aggregations.
`` - Use
sparingly: It’s slow—prefer
or
[Sum of Sales Amount]
dax // Calculates YoY growth, ignoring region filters Sales YoY Growth = VAR CurrentSales = [Total Sales] VAR PriorSales = CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Date'[Date])) RETURN DIVIDE(CurrentSales - PriorSales, PriorSales)
VAR
SELECTEDVALUE
dax Debug Filter = "Region: " & SELECTEDVALUE(Sales[Region], "All")
ALLSELECTED
DIVIDE(numerator, denominator, 0)
ALLEXCEPT
❌ FILTER, SUM, RELATED
"How do you calculate % of total?"
DIVIDE([Measure], CALCULATE([Measure], ALL(Table)))
❌ DIVIDE([Measure], SUM(Table[Column])) (respects filters)
DIVIDE([Measure], SUM(Table[Column]))
"Why does RELATED return blank?"
"You need to show 'Sales % of Region Total' in a table. Users filter by year, but the % should always be relative to the region’s total (ignoring year). Which DAX measure works?"
✅ Answer:
Sales % of Region = DIVIDE( [Total Sales], CALCULATE([Total Sales], ALL('Date')) )
ALL('Date')
Sales[Region]
Challenge:Create a measure that shows "Sales vs. Category Average" (e.g., "This product’s sales are 120% of its category average").
Solution:
Sales vs Category Avg = VAR CurrentSales = [Total Sales] VAR CategoryAvg = CALCULATE( AVERAGE(Sales[Amount]), ALL(Products[ProductName]) // Remove product filter, keep category ) RETURN DIVIDE(CurrentSales, CategoryAvg)
ALL(Products[ProductName])
AVERAGE(Sales[Amount])
CALCULATE([Total Sales], ALLSELECTED(Sales))
RELATED(Products[Category])
DIVIDE([Numerator], [Denominator], 0)
/
SUMMARIZE(Sales, Products[Category], "Total", SUM(Sales[Amount]))
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.