COUSIN (MDX)
Returned Type
This function returns a member.
Syntax and Details
COUSIN(member_expression, higher_member_expression)
Where:
-
member_expression is an expression that returns a member.
-
higher_member_expression is an expression that returns a member that is a member of a higher level in the hierarchy that contains member_expression.
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 *