Challenge - 5 Problems
Variable Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ dax_lod_result
intermediate1:30remaining
Calculate Total Sales Using Variables
Given the following DAX measure, what is the output if the Sales table has 3 rows with SalesAmount values 100, 200, and 300?
Measure = VAR Total = SUM(Sales[SalesAmount]) RETURN Total
Power BI
Measure = VAR Total = SUM(Sales[SalesAmount]) RETURN Total
Attempts:
2 left
💡 Hint
Think about what SUM does over all rows and how the variable stores that result.
✗ Incorrect
The variable Total stores the sum of all SalesAmount values (100 + 200 + 300 = 600). The RETURN statement outputs this value.
🎯 Scenario
intermediate2:00remaining
Using Variables to Improve Readability
You want to calculate the profit margin percentage as (Total Profit / Total Sales) * 100. Which DAX measure below correctly uses variables to calculate this?
Attempts:
2 left
💡 Hint
Using variables for both numerator and denominator improves clarity and performance.
✗ Incorrect
Option D defines both Profit and SalesTotal as variables and then divides them, which is clear and efficient.
🔧 Formula Fix
advanced1:30remaining
Identify the Error in Variable Usage
What error will this DAX measure produce?
Measure = VAR Total = SUM(Sales[Amount]) RETURN Total + Total2
Power BI
Measure = VAR Total = SUM(Sales[Amount]) RETURN Total + Total2
Attempts:
2 left
💡 Hint
Check if all variables used in RETURN are declared.
✗ Incorrect
Total2 is used but never declared, causing a variable not found error.
❓ visualization
advanced2:00remaining
Best Visualization for Comparing Variable Results
You created two variables in a measure: VAR Sales2023 and VAR Sales2024. You want to show their values side by side for each product category. Which visualization is best?
Attempts:
2 left
💡 Hint
You want to compare two values side by side across categories.
✗ Incorrect
Clustered Column Chart allows side-by-side comparison of two measures per category.
🧠 Conceptual
expert2:30remaining
Understanding Variable Evaluation Context
Consider this DAX measure:
What does this measure calculate?
Measure = VAR TotalSales = SUM(Sales[Amount]) RETURN TotalSales + CALCULATE(SUM(Sales[Amount]), ALL(Sales))
What does this measure calculate?
Power BI
Measure = VAR TotalSales = SUM(Sales[Amount]) RETURN TotalSales + CALCULATE(SUM(Sales[Amount]), ALL(Sales))
Attempts:
2 left
💡 Hint
ALL removes filters, so CALCULATE returns total sales ignoring filters.
✗ Incorrect
TotalSales stores sum in current filters; CALCULATE with ALL returns total ignoring filters; adding both sums them.