Skip to main content
Skip table of contents

Ancestor

Returns the ancestor of a member at specified level or distance.

Syntax

CODE
Ancestor(<Member_Expression>,<Level>)
Ancestor(<Member_Expression>,<Numeric_Expression>)

Arguments


Member_ExpressionMDX expression that returns a member.
LevelMDX expression specifying a member level of the ancestor.
Numeric_ExpressionA number to specify a distance between the member and the ancestor.

Examples

Following example returns Activity class name for Activities and Activity Types.

CODE
CASE WHEN
  NOT ([Activity].CurrentMember IS [Activity].DefaultMember)
THEN
  Ancestor([Activity].CurrentMember, [Activity].[Class]).Name
END
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.