mdx 与前几周的平行日行

mdx with row of parallel days of prev weeks

我正在尝试编写一个包含多行平行日的 mdx。问题是我的 hyrarchy 是按月计算的。那是我的查询,但我知道我需要动态地进行查询。什么是正确的语法?

如果您需要以编程方式返回 7 天,那么您可以将 lag 函数应用于日期成员的末尾:

[Date time Online].[Date Key].&[201602152300].lag(7)

如果您需要将 now() 提供给 mdx 脚本,此模式很有用:

WITH
  MEMBER [Measures].[Key for Today] AS 
    Format
    (
      Now()
     ,'yyyyMMdd'
    ) 
  MEMBER [Measures].[Today string] AS 
    '[Date].[Calendar].[Date].&[' + [Measures].[Key for Today] + ']' 
  SET [Today] AS 
    StrToMember
    (
      [Measures].[Today string]
     ,constrained
    ) 
...