DAX function
IF — DAX function reference
Branch on a condition.
Syntax
dax
IF(<logical_test>, <value_if_true>, [<value_if_false>])
Examples
dax
IF([Sales] > 0, "Yes", "No")
→ One of two values
dax
IF(SUM(Sales[Amount]) > [Target], "Above target", "Below target")
→ A status label measure
dax
IF(ISBLANK([Total Sales]), BLANK(), IF([Total Sales] > 100000, "High", "Low"))
→ Nested IF — SWITCH(TRUE()) is usually cleaner past two levels
Common mistakes & gotchas
- Omitting value_if_false makes IF return BLANK() when the condition is false — fine for measures (blanks are hidden in most visuals) but can surprise you in a calculated column, where you’ll see a literal blank cell.
- IF tries to keep a consistent data type across both branches; mixing types (a number and a string) triggers implicit conversion to text — keep both branches the same type to avoid unexpected formatting.
Related DAX functions
From Logical & error handling