문제

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".

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top