docs.intersystems.com
Home / InterSystems MDX Reference / MDX Functions / ANCESTOR


InterSystems MDX Reference
ANCESTOR
Previous section           Next section
InterSystems: The power behind what matters   
Search:  


Returns the ancestor of the given member, within the given level.
Returned Type
This function returns a member.
Syntax and Details
ANCESTOR(member_expression,ancestor_level)
Where:
This function returns the ancestor of the given member, within the given level.
Example
The following query displays the year that is the ancestor of March 24, 1943:
SELECT MEASURES.[%COUNT] ON 0, ANCESTOR(birthd.[Mar 24 1943],birthd.year) ON 1 FROM patients
 
                             Patient Count
1943                                     76
In contrast, the following query displays the period that is the ancestor of March 24, 1943:
SELECT MEASURES.[%COUNT] ON 0, ANCESTOR(birthd.[Mar 24 1943],birthd.period) ON 1 FROM patients
 
                             Patient Count
Mar-1943                                  5
See Also


Previous section           Next section
View this book as PDF
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-02-14 22:44:32