Challenge - 5 Problems
SWITCH Function Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ dax_lod_result
intermediate2:00remaining
Output of SWITCH with numeric expression
What is the result of this DAX measure?
Measure = SWITCH(2, 1, "One", 2, "Two", 3, "Three", "Other")
Power BI
Measure = SWITCH(2, 1, "One", 2, "Two", 3, "Three", "Other")
Attempts:
2 left
💡 Hint
SWITCH compares the first argument to each value in pairs.
✗ Incorrect
The SWITCH function compares the first argument (2) to each value (1, 2, 3). It matches 2, so returns "Two".
🎯 Scenario
intermediate2:00remaining
Using SWITCH for category labels
You have a sales table with a column 'RegionCode' containing values 1, 2, or 3. You want a measure that returns "North" for 1, "South" for 2, "East" for 3, and "Unknown" otherwise.
Which DAX expression correctly implements this?
Which DAX expression correctly implements this?
Attempts:
2 left
💡 Hint
Match the numeric RegionCode directly without TRUE() when comparing values.
✗ Incorrect
Option D correctly uses SWITCH with the expression [RegionCode] and matches numeric values 1, 2, 3. Options C and D compare to strings which won't match numeric codes. Option D uses SWITCH(TRUE()) but compares numeric values without quotes, which is valid but less direct.
🔧 Formula Fix
advanced2:00remaining
Identify error in SWITCH with missing default
What error occurs when running this DAX measure?
Assume [Score] can be 4.
Measure = SWITCH([Score], 1, "Low", 2, "Medium", 3, "High")
Assume [Score] can be 4.
Power BI
Measure = SWITCH([Score], 1, "Low", 2, "Medium", 3, "High")
Attempts:
2 left
💡 Hint
SWITCH returns blank if no match and no default is provided.
✗ Incorrect
When no match is found and no default value is specified, SWITCH returns blank (empty) instead of an error.
❓ visualization
advanced2:00remaining
Best visualization for SWITCH-based category measure
You created a measure using SWITCH to categorize customers into "New", "Active", and "Churned" based on purchase dates.
Which visualization best shows the count of customers per category clearly and accessibly?
Which visualization best shows the count of customers per category clearly and accessibly?
Attempts:
2 left
💡 Hint
Think about showing parts of a whole clearly with labels.
✗ Incorrect
A pie chart clearly shows proportions of categories with distinct colors and labels, making it easy to understand customer distribution.
🧠 Conceptual
expert2:00remaining
SWITCH vs Nested IF performance and readability
Which statement best explains the advantage of using SWITCH over nested IF statements in DAX for multiple conditions?
Attempts:
2 left
💡 Hint
Consider how many times the expression is evaluated in SWITCH vs IF.
✗ Incorrect
SWITCH evaluates the expression once and compares it to multiple values, improving readability and often performance. Nested IF evaluates each condition separately, which can be less efficient and harder to read.