Skip to main content

Member & Set Expressions

Member Expressions

A member expression starts from a single member in a dimension and optionally uses various methods to derive a set of members from the same dimension. Derivation methods are appended using the dot operator:

dimension.member_spec[.derived_method[(arg)]...]

Member specification can be:

  • A member name
  • A member key prefixed by &
  • A member tag prefixed by #
  • The special keyword CurrentMember
note

Members cannot be referenced by Caption.

Examples:

[Account].[Rent]
[Account].#[netincome].[SelfAndDescendants]
[Period].CurrentMember.Ancestor(2).FirstLeafDescendant
[Department].&[23].Siblings
[Period].CurrentMember.SelfAndNext(11)

CurrentMember references (known as relative references) are only supported in assignments.

Note on Identifiers

Square brackets are used to enclose identifiers that start with or contain special characters. Anything in brackets will always be considered an identifier and never a keyword.

Therefore, [Account].CurrentMember and [Account].[CurrentMember] are two different things:

  • The former refers to the current member in the Account dimension
  • The latter refers to the account named "CurrentMember"
Best Practice

Enclose all dimensions, keys, names, and tags in brackets, and leave functions/methods without brackets.

Supported Methods

MethodRelative SupportedDescription
Ancestor(n)Returns the ancestor n levels up. Nothing if member's level is < n
ChildrenReturns all children of the member
DescendantsReturns all descendants of the member (excluding the member)
FirstReturns the first member of a set in natural dimension order
FirstLeafDescendantReturns the first leaf descendant of the member (including the member itself)
LastReturns the last member of a set in natural dimension order
LastLeafDescendantReturns the last leaf descendant of the member (including the member itself)
LeafDescendantsReturns all leaf descendants of the member. If the member is a leaf, returns the member
Next(n)Returns at most n members on the same level as the referenced member, excluding the member itself
NextMemberReturns the next member on the same level of the hierarchy. Equivalent to Next(1)
ParentReturns the parent member. Will return the virtual root for level 1 members. Equivalent to Ancestor(1)
Prev(n)Returns the previous at most n members on the same level as the referenced member, excluding the member itself
PrevMemberReturns the previous member on the same level of the hierarchy. Equivalent to Prev(1)
SelfAndChildrenReturns the member and its children
SelfAndDescendantsReturns the member and its descendants
SelfAndNext(n)Like Next(n) but includes the referenced member. Referenced member is included in the count
SelfAndPrev(n)Like Prev(n) but includes the referenced member. Referenced member is included in the count
SiblingsReturns all children of the parent member, including the referenced member

For methods that support arguments, the argument must be an integer constant—it cannot be an expression. As an exception, Ancestor() also supports a parameter as the argument.

Set Expressions

Set expressions combine multiple member expressions using set operators:

FunctionDescription
Union(set1, set2[, setn...])Performs a union between all sets; eliminates duplicate members
Intersect(set1, set2[, setn...])Performs an intersection between all sets; eliminates duplicate members
Except(set1, set2[, setn...])Discards from set1 all members that exist in set2 through setn
Range(set1, set2)Returns all members between set1 and set2. Both arguments must be single-member sets that are on the same level in the hierarchy
note

Set expressions are supported only in Scope and Freeze statements.