Learning
Community
Open Exchange
Global Masters
InterSystems IRIS Data Platform 2019.4 / Analytics / InterSystems MDX Reference / MDX Functions / COUSIN
Previous section   Next section

COUSIN

Given a reference member and a member of a higher level in the same hierarchy, this function finds the ancestor of the reference member at that higher level, determines the relative position of the reference member to that ancestor, and then returns the descendent of the higher member that has the same relative position. This function is intended primarily for use with time levels.

Returned Type

This function returns a member.

Syntax and Details

COUSIN(member_expression, higher_member_expression)
Where:
These expressions cannot refer to measures.
This function finds the ancestor of the reference member at the higher level, determines the relative position of the reference member to that ancestor, and then returns the descendent of the higher member that has the same relative position. If no such member is found, this function returns an empty set.

Example

For example, the following query finds the cousin of March 24, 1943, within the year 1990:
SELECT MEASURES.[%COUNT] ON 0, COUSIN(birthd.[Mar 24 1943],birthd.1990) ON 1 FROM patients
 
                             Patient Count
Mar 24 1990                               1
In contrast, the following query finds the cousin of March 24, 1943, within January 1990:
SELECT MEASURES.[%COUNT] ON 0, COUSIN(birthd.[Mar 24 1943],birthd.[jan-1990]) ON 1 FROM patients
 
                             Patient Count
Jan 24 1990                               *

See Also

Previous section   Next section