IIf statement
Evaluates different branch expressions depending on whether a Boolean condition is true or false.
Syntax
IIf(Logical_Expression, Value1_Expression, Value2_Expression)
Arguments
Logical_Expression | A condition that evaluates to true (1) or false (0). It must be a valid Multidimensional Expressions (MDX) logical expression. |
---|---|
Value1_Expression | Used when the logical expression evaluates to true. Expression1 must be a valid Multidimensional Expressions (MDX) expression. |
Value2_Expression | Used when the logical expression evaluates to false. Expression2 must be valid Multidimensional Expressions (MDX) expression. |
In other words, the IIf function takes three arguments: IIf(<condition>, <then branch>, <else branch>).
The IIf function is not recommended for creating a set of members based on search criteria.
Examples
Returns a string "Overdue" if the due date is before today. If due date is today or after today string "On Schedule" is returned.
--example of IIf IIf( DateCompare([Issue].CurrentMember.get('Due date'), "Today")<0, "On Schedule", "Overdue" )
See also
- Description of conditions in calculated measures
- CASE WHEN statement
- DateCompare function
If, iff