IF Function (DAX)

How does the IF function (DAX) work?

IF function (DAX) checks whether a condition is satisfied as the first statement. It returns one value if the condition is TRUE, and if the condition is FALSE returns another value.

IF Formula Syntax

IF(logical_test>,<value_if_true>, value_if_false) 

How do you use the IF function?

The IF function attempts to return a single data type in a column. Therefore, if the values returned by value_if_true and value_if_false are of different data types, the IF function will implicitly convert data types to accommodate both values in the column. For example, the formula IF(<condition>,TRUE(),0) returns a column of ones and zeros and the results can be summed, but the formula IF(<condition>,TRUE(),FALSE()) returns only logical values.

Related Blog Posts

Related Support Forum Posts

IF Function needs a calculation
Getting totals correct when using the budget allocation formula
Multiple dynamic filters

Considerations when using the IF function

If the value of value_if_true or value_if_false is omitted, IF treats it as an empty string value (“”).

If the value referenced in the expression is a column, IF returns the value that corresponds to the current row.

Related Video Tutorials

EDNA TV-Unique subtotal
EDNA TV-Harvesting a slicer selection

Formula examples using the IF function

=IF([StateProvinceCode]= "CA" && ([MaritalStatus] = "M" || [NumberChildrenAtHome] >1),[City])

Related DAX Functions


Related Course Modules



Download our comprehensive DAX Formula Reference Guide as perfect companion as you learn how to use DAX formulas within Power BI.

Download DAX Formulas Reference Guide
Download DAX Formula Reference Guide