HOPENINGPERIOD

HOPENINGPERIOD works in a similar way to OPENINGPERIOD but can be used with multiple hierarchies. It has the additional TopNode parameter. TopNode indicates the hierarchy to be used.

Multiple hierarchies are those in which an element has multiple parents. This is common in time-based dimensions.

For example, a Time dimension may contain a hierarchy of years, quarters and months. January, February and March are within Quarter 1. Quarter 1 is within a year.

But the dimension may also contain a year-to-date hierarchy containing a cumulative year parent, cumulative months, and months. So, Cumulative Month 1 contains January, Cumulative Month 2 contains January and February and Cumulative Month 3 contains January, February and March.

In this example, OpeningPeriod returns an empty string because it is unable to determine which hierarchy (Year or Cumulative Year) is intended.

Syntax

HOpeningPeriod(Dimension, Element, DistanceFromTopNode, TopNode)

Examples

For these examples, use the SALES cube.

This example returns '01_2009':

HOpeningPeriod('Time', '05_2010', 0, 'All Years')

This example returns '01_2010':

HOpeningPeriod('Time', '05_2010', 1, 'All Years')

This example returns '04_2010':

HOpeningPeriod('Time', '05_2010', 2, 'All Years')

This example returns '00_2009':

HOpeningPeriod('Time', '05_2010', 0, 'YTD')

This example returns '00_2010':

HOpeningPeriod('Time', '05_2010', 1, 'YTD')

This example returns '00_2010':

HOpeningPeriod('Time', '05_2010', 2, 'YTD')