在 MDX 中汇总开始日期和最后日期之前的日期

Aggregate between start date and date before last in MDX

低于成员 returns 我 运行 第一个日期和所选日期之间的总计。是否可以将数据聚合到一个 day/week/month 之前?

WITH 
MEMBER [Measures].[SUM] AS
AGGREGATE(
    NULL:TAIL(EXISTING [Date].[Date].[Date].Members).Item(0), 
    [Measures].[X]
)

示例如下(日期可以是日、月、年...):

DATE X SUM
------------
 1   1 NULL
 2   4  1
 3   2  5
 4   2  7

我想你差不多明白了 - 结束聚合 x 天后你可以使用延迟:

WITH 
MEMBER [Measures].[SUM] AS
AGGREGATE(
    NULL
   :
    TAIL(
      EXISTING [Date].[Date].[Date].Members
    ).Item(0).lag(7) //<<<< finishes 7 days before chosen date
  ,[Measures].[X]
)