Partilhar via


IF Statement (MDX)

Executes a statement if the condition is true.

Syntax

IF expression THEN assignment END IF

Arguments

  • expression
    A Multidimensional Expressions (MDX) expression that evaluates to a Boolean that returns true or false.
  • assignment
    An MDX expression that assigns a value to either a subcube or a calculated property.

Remarks

Use the IF statement for control flow, which is unlike the IIf (MDX) function and the CASE Statement (MDX) that can only be used to return values or objects.

Example

In the following example, the scope is restricted to the Country members of the Customers hierarchy in the Customers dimension. If the current measure is Store Cost, then the Store Cost is set to 10:

SCOPE ([Customer].[Customers].[Country].members);
  IF Measures.CurrentMember IS [Measures].[Store Cost] THEN this = 10 END IF;

See Also

Reference

MDX Function Reference (MDX)

Help and Information

Getting SQL Server 2005 Assistance