Export (0) Print
Expand All
Avg
IIf
Lag
Max
Min
Mtd
Qtd
Sum
Var
Wtd
Ytd
Expand Minimize

IIf (MDX)

Updated: 17 July 2006

Returns one of two values determined by a logical test.


IIf(Logical_Expression, Expression1, Expression2)

Logical_Expression

A valid Multidimensional Expressions (MDX) logical expression that evaluates to true or false.

Expression1

A valid Multidimensional Expressions (MDX) expression.

Expression2

A valid Multidimensional Expressions (MDX) expression.

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.

ms145994.note(en-US,SQL.90).gifNote:
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.

ms145994.note(en-US,SQL.90).gifNote:
If either expression evaluates to NULL, the result set will be NULL when that condition is met.

Release History

17 July 2006

Changed content:
  • Updated syntax and arguments to improve clarity.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft