Returns one of two values determined by a logical test.
The expression specified by the logical expression evaluates to false only if the value of this expression is zero. Any other value evaluates to true.
If the specified logical expression evaluates to true, the IIf function returns the first expression. Otherwise, the function returns the second expression.
The specified expressions can return values or MDX objects. Furthermore, the specified expressions need not match in type.
|In Microsoft SQL Server 2000, Analysis Services supported only numeric and string return types, and the types of specified expressions had to be the same. These restrictions do not apply to SQL Server 2005 Analysis Services (SSAS).|
The IIf function is not recommended for creating a set of members based on search criteria. Instead, use the Filter function to evaluate each member in a specified set against a logical expression and return a subset of members.
|If either expression evaluates to NULL, the result set will be NULL when that condition is met.|