Back to Roadmap
Level 5 — Real-World DAX Patterns+75 XP
Lesson 4

4. The SWITCH Function

Clean multi-case conditional logic without nested IF statements.

The Concept

SWITCH evaluates a value against multiple cases. SWITCH(TRUE(), ...) acts like an elegant case-when statement.
Example DAX:
Customer Tier = 
SWITCH(
    TRUE(),
    [Total Revenue] > 10000, "Tier 1",
    [Total Revenue] > 5000, "Tier 2",
    "Standard"
)

Using SWITCH(TRUE(), ...) is vastly cleaner and more readable than writing 5 nested IF() statements.

Try It Yourself

Create a simple SWITCH checking SELECTEDVALUE(Customers[Segment]): if 'Enterprise' then 0.15, else 0.05.

fx
[fx]The SWITCH Function=
Loading DAX Formula Studio...
Type [ for fields