Question

I have a fairly standard Date dimension with Fiscal Hierarchy

FiscalYear -> FiscalQuarter -> FiscalMonth -> FiscalWeek -> Date

I'm trying to define an MDX expression to find the month member from any point in the cube. In other words, whatever the CurrentMember is in the hierarchy (from fiscal month down to a single date), I want to return the month attribute.

What I'm trying to do is create a MonthToDate (MTD) previous period comparison KPI, where let's say we are 15 days into the current Fiscal month. I calculate the MTD for the current month (that's working) using:

MEMBER [Measures].[FY MTD Revenue Amount] AS
    Aggregate(
        PeriodsToDate([Date].[Fiscal].[Month], [Date].[Fiscal].CurrentMember)
        , [Measures].[Revenue Amount]
    )

and I want to compare this with the (whole previous fiscal year's month amount / Number of days in previous year's fiscal month) * 15

I can calculate the previous year's Month-to-Date MTD using:

MEMBER [Measures].[FY MTD Revenue Amount Year Ago] AS
    Aggregate
    (
         PeriodsToDate([Date].[Fiscal].[Month], ParallelPeriod([Date].[Fiscal].[Fiscal Year], 1, [Date].[Fiscal].CurrentMember))
        ,[Measures].[Revenue Amount]
    )

but what I really want is the "average day value for previous years month".

Was it helpful?

Solution

Ok, Solved it. I was thinking about it in the wrong way (as is often the case with MDX!).

Created a tuple using Ancestor. This works at the Day, Week and Month levels. I will need to use a SCOPE statement to control where it is applicable:

MEMBER [Measures].[FY Month Revenue Amount Year Ago] AS
(
    Ancestor(ParallelPeriod([Date].[Fiscal].[Fiscal Year], 1, [Date].[Fiscal].CurrentMember),
             [Date].[Fiscal].[Month])
     ,[Measures].[Revenue Amount]
)

It finds the member in the previous fiscal year at the same relative position to the CurrentMember, then gets the ancestor of that member in the Fiscal Month hierarchy.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top