TM1: Leaf or N Level Dimension (Period N or Leaf only Time Dimension)
TM1 Leaf or N Level Dimension (Period N or Leaf only Time Dimension)
Many times when developing reports or running a TI process, I have come across the need to get a list of the previous or next n number of months. This is typically obtained by using the LastPeriods MDX statement.
When using the usual continuous period or date dimension, this can sometimes be a challenge when you start to cross over into different consolidations. Inconsistent results can arise when you start using the dimension index depending on how your dime nsion was constructed initially.
Using the example below, when getting a list of the last 6 months from 2012-09 in a continuous time dimension, the result can sometimes be incorrect as shown in Figure 1.
A simple and clean way of solving this issue is to create a separate Dimension N (Period N in this example), which contains only leaf level elements ordered correctly. This dimension can then be called upon and substituted in whenever there is a need to get the previous or next n number of months.
Using the same example as described above, but substituting in the leaf only dimension would give a correct result as shown in Figure 2.