Returns all ancestors of the members in the specified member list or all ancestors up to a specified generation or level. This function excludes the specified members.
You can use the @LANCESTORS function as a parameter of another function, where the function requires a list of members.
@LANCESTORS ((memberSetFunction) [,genLevNum])
A member set function that returns a list of members.
How the @LANCESTORS function is used determines which member set functions are allowed. Follow these guidelines:
Optional. The integer value that defines the absolute generation or level number up to which to select members. A positive integer defines a generation number. A value of 0 or a negative integer defines a level number.
All examples are from the Sample.Basic database.
Returns 100 (the ancestor of 100-10); and 200 (the ancestor of 200-20). Excludes Product because it is at generation 1.
Returns Product (the ancestor of 100); and 100 (the ancestor of 100-10). The result does not contain duplicate members.
Returns Product (the ancestor of 100 and 200). The result does not contain duplicate members.
FIX(@LANCESTORS(@UDA(Market,“New Market”)),2) ... ENDFIX;
Returns West, South, and Central (the ancestors, to generation 2, for the members in the Market dimension that are associated with the New Market attribute).
FIX(@LANCESTORS(@ATTRIBUTE(Caffeinated_True),@ATTRIBUTE(Ounces_12),"200–40”)) ... ENDFIX;
Returns 100, 200, 300, and Product (the ancestors of 100-10, 100-20, 200-10, 300-30—caffeinated, 12-ounce drinks, and 200-40).