0
0
Power BIbi_tool~20 mins

CALCULATE function introduction in Power BI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
CALCULATE Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
dax_lod_result
intermediate
2:00remaining
Calculate Total Sales for a Specific Year
Given a Sales table with columns [SalesAmount] and [Year], what is the result of this DAX measure?

TotalSales2019 = CALCULATE(SUM(Sales[SalesAmount]), Sales[Year] = 2019)

If the Sales table has these rows:
- Year: 2018, SalesAmount: 100
- Year: 2019, SalesAmount: 200
- Year: 2019, SalesAmount: 300
- Year: 2020, SalesAmount: 400

What is the value of TotalSales2019?
Power BI
TotalSales2019 = CALCULATE(SUM(Sales[SalesAmount]), Sales[Year] = 2019)
A500
B1000
C400
D300
Attempts:
2 left
💡 Hint
Think about filtering only the rows where Year is 2019 before summing.
visualization
intermediate
2:00remaining
Visualizing Sales with CALCULATE Filter
You want to create a bar chart showing total sales only for the year 2020 using a measure with CALCULATE.

Which of these DAX measures will correctly show total sales for 2020 in the bar chart?
ATotalSales2020 = CALCULATE(SUM(Sales[SalesAmount]), FILTER(Sales, Sales[Year] <> 2020))
BTotalSales2020 = CALCULATE(SUM(Sales[SalesAmount]), Sales[Year] = 2020)
CTotalSales2020 = SUM(Sales[SalesAmount]) + Sales[Year] = 2020
DTotalSales2020 = CALCULATE(SUM(Sales[SalesAmount]), ALL(Sales[Year]))
Attempts:
2 left
💡 Hint
Remember CALCULATE changes the filter context to what you specify.
🧠 Conceptual
advanced
1:30remaining
Understanding CALCULATE Filter Context Modification
Which statement best describes what the CALCULATE function does in DAX?
AIt creates a new table with all rows from the original table.
BIt only sums numeric columns without any filtering.
CIt changes the filter context for the calculation by applying specified filters.
DIt removes all filters from the current report page.
Attempts:
2 left
💡 Hint
Think about how CALCULATE affects what data is included in a measure.
🔧 Formula Fix
advanced
1:30remaining
Identify the Error in CALCULATE Usage
What error will this DAX measure cause?

Measure = CALCULATE(SUM(Sales[Amount]), Sales[Year] == 2021)
Power BI
Measure = CALCULATE(SUM(Sales[Amount]), Sales[Year] == 2021)
ASyntax error due to double equals (==) instead of single equals (=)
BNo error, measure returns sum for year 2021
CType error because SUM cannot be used inside CALCULATE
DRuntime error because Sales[Year] column does not exist
Attempts:
2 left
💡 Hint
Check the filter condition syntax inside CALCULATE.
🎯 Scenario
expert
2:30remaining
Using CALCULATE to Override Existing Filters
You have a report page filtered to Year = 2022. You want a measure that shows total sales for Year = 2021 regardless of the page filter.

Which DAX measure achieves this?
ATotalSales2021 = CALCULATE(SUM(Sales[SalesAmount]), Sales[Year] = 2021)
BTotalSales2021 = CALCULATE(SUM(Sales[SalesAmount]), REMOVEFILTERS(Sales[Year]))
CTotalSales2021 = SUM(Sales[SalesAmount])
DTotalSales2021 = CALCULATE(SUM(Sales[SalesAmount]), ALL(Sales[Year]), Sales[Year] = 2021)
Attempts:
2 left
💡 Hint
Think about how to ignore existing filters on Year before applying your own filter.