This section describes how to create and use member expressions in InterSystems MDX.
In InterSystems MDX, a member expression can have any of the following forms:
An member literal, which is an explicit reference to a single member by its name:
For a measure, a member literal has the following variant form, because any measure is a member of a dimension called Measures. This dimension does not have a hierarchy or a level.
Note that although a measure is a member, an expression like the preceding returns a scalar value and cannot be used in all the same ways as other member expressions.
An explicit reference to a hierarchy as follows:
This expression returns the All member of the dimension to which the hierarchy belongs.
The preceding expression returns the All member of the AgeD
dimension; in the sample Patients
cube, the name of this member is All Patients
An expression that uses an MDX function to return a single member. For example:
An expression that uses the internal key of a member to return that member, via the following syntax:
is the value of the KEY property of the member. For example:
Note that member_key
is a case-sensitive literal value rather than an expression. That is, you cannot replace it with a string-valued expression.
An expression that uses an InterSystems MDX extension to refer to a member in another cube, via the following syntax:
A reference to a pivot variable that contains a member expression. To refer to a pivot variable, use the following syntax:
is the logical variable name. Do not enclose this expression with square brackets. This syntax is not case-sensitive; nor is the pivot variable name.
For example, the following member expressions are all equivalent:
Members can be defined within the cube definition, as part of the definition of a level. You can also create calculated members
, which are typically based on other members. You can define calculated members in two ways:
Within the WITH
clause of a query. The member is available within the rest of the query, but is not available in other queries.
Within the CREATE MEMBER
statement. The member is available within the rest of the session (for example, within the rest of the session in the MDX shell).
You can use member expressions in the following ways:
As a member argument to many MDX functions.
As the argument to the WHERE