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
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
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
Formula examples using the IF function
=IF([StateProvinceCode]= "CA" && ([MaritalStatus] = "M" || [NumberChildrenAtHome] >1),[City])
Related DAX Functions
Related Course Modules
To access our comprehensive DAX formula reference guide just insert your email address below. The resource will download immediately and we’ll also email it to you.