I have a requirement to perform a calculation on the last 4 months of data, and I need to perform a check on month individually, however the challenging part is our Time dimension includes an addition "ADJustment" member at the Month level as the
final EoY member, so that hierarchy and members look something like this:
[2019]
[2019.Q4]
[2019.JAN]
[2019.FEB]
[2019.MAR]
[2019.Q4]
[2019.APR]
[2019.MAY]
[2019.JUN]
[2019.ADJ]
[2020]
[2020.Q1]
[2019.JUL]
[2019.AUG]
[2019.SEP]
...
For closing off the FY, some measures use the [YYYY.JUN] member and others use the [YYYY.ADJ] member as it includes data updated once the year is closed off.
I'm need to perform calculations at the month level and dynamically look at the value for the last 4 months, however need to handle the crossover of FYs and use [YYYY.JUN] instead of [YYYY.ADJ]. What would the best way of doing this?
I tried the following 2 measures:
MEMBER [Measures].[Sales LM1] AS
IIF(PARALLELPERIOD([Time].[H1].[MONTH], 2,[Time].[H1].[2019.AUG]) = PARALLELPERIOD([Time].[H1].[MONTH], 2, [Time].[H1].[2019.AUG]).PARENT.PARENT.LASTCHILD.LASTCHILD,
-- myMeasure back 3 months to avoid ADJ PARALLELPERIOD([Time].[H1].[MONTH], 3,STRTOMEMBER('[Time].[H1].[2019.AUG]')),
,
-- myMeasure back 2 months as per normal PARALLELPERIOD([Time].[H1].[MONTH], 2,STRTOMEMBER('[Time].[H1].[2019.AUG]')),
)
MEMBER [Measures].[Sales LM2] AS
IIF(PARALLELPERIOD([Time].[H1].[MONTH], 3,[Time].[H1].[2019.AUG]) = PARALLELPERIOD([Time].[H1].[MONTH], 3, [Time].[H1].[2019.AUG]).PARENT.PARENT.LASTCHILD.LASTCHILD,
-- myMeasure back 4 months to avoid ADJ PARALLELPERIOD([Time].[H1].[MONTH], 4,STRTOMEMBER('[Time].[H1].[2019.AUG]')),
,
-- myMeasure back 3 months as per normal PARALLELPERIOD([Time].[H1].[MONTH], 3,STRTOMEMBER('[Time].[H1].[2019.AUG]')),
)
The first one "Sales LM1" works (so far) and skips the "ADJ" month to return "JUN" values. However, "Sales LM2" gives an error, "Infinite recursion detected. The loop of dependencies is Sales LM2 -> Sales
LM2."
Can someone help explain what is going on and a better way to solve this?
Thanks, being Friday afternoon here I'm done until Monday, so will check then.