Cheat Sheets/Power BI/SWITCH(TRUE())
DAX function

SWITCH(TRUE())DAX function reference

If / else-if chain.

Syntax

dax
SWITCH(TRUE(), <condition1>, <result1>, [<condition2>, <result2>, …], [<else>])

Examples

dax
SWITCH(TRUE(), [Margin] > 0.3, "High", [Margin] > 0.1, "Mid", "Low")
First true branch
dax
SWITCH(
    TRUE(),
    ISBLANK([Total Sales]), "No sales",
    [Total Sales] >= [Target], "Hit target",
    [Total Sales] >= [Target] * 0.9, "Near target",
    "Below target"
)
A multi-tier status measure, evaluated top to bottom
dax
SWITCH(TRUE(), [Days Overdue] > 90, "Critical", [Days Overdue] > 30, "Warning", [Days Overdue] > 0, "Late", "Current")
Aging-bucket classification

Common mistakes & gotchas

Related DAX functions

From Logical & error handling

Used in these tutorials

← Back to the Power BI (DAX) cheat sheet