0

I'm confident that this has been addressed before, but I haven't been able to find it. I have found answers relating to individual MDX queries for a given date, but I don't know how to translate that into a Calculated Member of an SSAS cube that is going to work regularly.

I'd like to create a calculated member in SSAS which sums revenue from start of the previous year to the currentmember, but stops and the current date in the previous year. E.g., today is 10/16/2013. I'd like this calculated member to provide a YTD sum which includes revenue to 10/16/2012. This is so that the rollup of Q4 2012 includes only the first 16 days of Q4 2012, rather than the entire year.

Here is the current definition of the prior year to date calculated member:

SUM(
        YTD(
        ParallelPeriod([Time Order Date].[Order Date Calendar Hierarchy].[Year], 
        1,
        [Time Order Date].[Order Date Calendar Hierarchy].CurrentMember
        )
    ),
        [Measures].[Product Rev (with ship, with disc)]
    )

FWIW, my time dimension table has all of the day of year, day of quarter, day of month, etc columns that could be used.

Thanks, --sw

4

1 回答 1

0

我对这个问题也很感兴趣,但是我不会使用 YTD 函数,因为它只能用于日历年。使用您的数据元素和层次结构,我会将其更改为使用 PeriodsToDate 函数:

Aggregate(  PeriodsToDate(  [Time Order Date].[Order Date Calendar Hierarchy].[Year]
                            ,ParallelPeriod(    [Time Order Date].[Order Date Calendar Hierarchy].[Year]
                                                    ,1
                                                    ,[Time Order Date].[Order Date Calendar Hierarchy].CurrentMember
                                                )
                             )
                ,[Measures].[Product Rev (with ship, with disc)]
             )
于 2013-10-17T20:11:41.467 回答