IF DAX function is used to checks a condition, and returns one value when it’s TRUE, otherwise it returns a second value. It’s comes under Logical DAX function category.
IF(<logical_test>, <value_if_true>[, <value_if_false>])
|1||logical_test||Any value or expression that can be evaluated to TRUE or FALSE.|
|2||value_if_true||The value that’s returned if the logical test is TRUE.|
|3||value_if_false||(Optional) The value that’s returned if the logical test is FALSE. If omitted, BLANK is returned.|
So, Let’s start with an example, you can download the sample Dataset from below link
Step-1: Create one measure and write IF condition as mentioned below.
IF Condition = Var TotalSales = SUM(Orders[Sales]) Return IF(TotalSales >= 100000, "Profit", "Loss")
Step-2 : Create a another measure for nested IF condition.
Nested_IF = Var TotalSales= SUM(Orders[Sales]) Return IF(TotalSales<50000, "Low", IF(TotalSales>50000 && TotalSales< 100000, "Medium", IF(TotalSales>100000, "High", "Other" ) ) )
Step-3: Drag both measures to Table visual
Hope you enjoyed the post. Your valuable feedback, question, or comments about this post are always welcome or you can leave us message on our contact form , we will revert to you asap.