Checks whether a condition is met, and returns one value if TRUE, and another value if FALSE.
Any value or expression that can be evaluated to TRUE or FALSE.
The value that is returned if the logical test is TRUE.
The value that is returned if the logical test is FALSE.
Either ResultIfTrue or ResultIfFalse expression result, depending on LogicalTest.
Using IF can generate multiple branches of code execution that could result in slower performance at query time.
Then IF can return BLANK as one of the results, there are cases where using DIVIDE to obtain the same result could produce a faster query plan.
The following code returns BLANK if LogicalTest is false.
IF ( <LogicalTest>, <ResultIfTrue> )
The previous code is semantically equivalent to the following expression:
DIVIDE ( <ResultIfTrue>, <LogicalTest> )
Learn more about IF in the following articles:
Contributors: Alberto Ferrari, Marco Russo
MSDN documentation: https://docs.microsoft.com/en-us/dax/if-function-dax