IF DAX Function

The IF DAX function tests whether a condition that's provided as the first argument is met. It returns one value if the condition is TRUE and returns the other value if the condition is FALSE.

DAX Syntax IF(<logical_test>, <value_if_true>[, <value_if_false>])

Example: The following Sheet table calculated column definitions use the IF function in different ways to classify each 10th Marks based on its value.

a) The first example tests whether the 10th Marks column value is more than 400. When this condition is true, the value Distinction is returned. Because there's no value_if_false value, BLANK is returned.

DAX

Classification = IF('Sheet1'[10th Marks]>400,"Distinction")
IF dax function

b) The second example uses the same test, but this time includes a value_if_false value. So, the formula classifies each 10th Marks as either Distinction or Pass.

DAX

Classification = IF('Sheet1'[10th Marks]>400,"Distinction", "Pass")
IF dax function

c) The third example uses the same test, but this time nests an IF function to perform an additional test. So, the formula classifies each product as either Distinction, Pass, or Fail.

DAX

Classification = IF('Sheet1'[10th Marks]>400,"Distinction", IF('Sheet1'[10th Marks]>300,"Pass", "Fail"))
IF dax function