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

PARALLELPERIOD

Given a reference member, a parent level of that member, and an integer, this function counts backward in the parent level, finds a previous member in that level, and then returns its child that has the same position as the reference member.

Returned Type

This function returns a member.

Syntax and Details

PARALLELPERIOD(level_expression,offset,member_expression) 
Where:
  • level_expression is an expression that returns a level. For example:
    [dimension_name].[hierarchy_name].[level_name]
    
    This level must be a higher level within the hierarchy that contains the reference member.
  • offset is an integer literal.
    You can use negative integers.
  • This expression cannot refer to a measure.
    This is used as the reference member.
For the given member, this function examines the ancestor within the given level, counts backward from that member (using offset), finds another member in that level, and returns the child member that has the same position as the reference member.
This function ignores the hierarchy; that is, two members can be considered adjacent even if they have different parents.

Example

For example, the following query finds the quarter that is parallel to Q1 1943, by looking back one year:
SELECT MEASURES.[%COUNT] ON 0, PARALLELPERIOD(birthd.year,1,birthd.[Q1 1943]) ON 1 FROM patients
 
                             Patient Count
Q1 1942                                  22
In contrast, the following query finds the quarter that is parallel to Q1 1943, by looking one decade backward:
SELECT MEASURES.[%COUNT] ON 0, PARALLELPERIOD(birthd.decade,1,birthd.[Q1 1943]) ON 1 FROM patients
 
                             Patient Count
Q1 1939                                  17
As noted previously, you can specify a negative integer for offset. The following query finds the quarter that is parallel to Q1 1943, by looking ahead three years:
SELECT MEASURES.[%COUNT] ON 0, PARALLELPERIOD(birthd.year,-3,birthd.[Q1 1943]) ON 1 FROM patients
 
                             Patient Count
Q1 1946                                  18

See Also

Previous section   Next section