Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
  • Specified Ancestors of a specified member at a specified level

Description:
This function is used to return the ancestor set of all ancestors of a specified member at a specified level.
Syntax:
AncestorAncestors(Member_Expression, Level_Expression)
Return Type:
MEMBERSET

Parameters:

Parameter

Description

Member_Expression

It is a valid MDX expression that returns a member.

Level_Expression

It is a valid MDX expression that returns a level..

...

Code Block
languagejava
WITH MEMBER Measures.x AS [Measures].[Customer Count] /   
   (  
   [Measures].[OrderCustomer Count],    
      Ancestor Ancestors   
        (  
         [Customer].[Geography].[Country].CurrentMember,    
          [Customer].[Geography].[Country]  
      ).Item  (0)  
   ), FORMAT_STRING = '0%'  
 SELECT {[Measures].[Customer Count], Measures.x} ON 0,  
 {  
   Descendants   
      (           [Customer].[Geography].[Country].&[Australia],  
           [Customer].[Geography].[State-Province], SELF   
     ) )  
} ON 1  
 FROM [AdventureWorksMF] 
  • Specified member at a specified distance from the member

Description:
This function is used to return the ancestor set of all ancestors of a specified member at a specified distance from the member.
Syntax:
AncestorAncestors(Member_Expression, Distance)
Return Type:
MEMBERSET

Parameters:

Parameter

Description

Member_Expression

It is a valid MDX expression that returns a member.

Distance

It is a A valid numeric expression that specifies the distance from the specified member.

Example

Code Block
languagejava
WITHSELECT MEMBER
Measures.x AS [Measures].[Customer Count] /   
   (  
   [Measures].[Order Count],    
      Ancestor   
         (  
         [Customer].[Geography].CurrentMember,  
 1         )  
   ), FORMAT_STRING = '0%'  
SELECT {[Measures].[Customer Count], Measures.x} ON 0,  
{  
   Descendants   
      Ancestors(  
        [Customer[Product].[GeographyProduct Categories].[CountryCategory].&[AustraliaAccessories],1  
           [Customer].[Geography].[State-Province], SELF   
      )  
} ON 1  
FROM from  [AdventureWorksMF]