【问题标题】:Create calculated member in SSAS using MDX使用 MDX 在 SSAS 中创建计算成员
【发布时间】:2019-07-10 11:40:02
【问题描述】:

致所有 MDX 大师, 我有一个在 SSAS 中创建成员的场景。有一个事实表,其中包含每天的数据快照。

2018Q1 是从 12 月到 2 月。要求是创建一个计算成员,如果在 2018 年第一季度切片,将给出 2018 年第一季度最后一天快照的不同价值计数,即 20180228(最后一天)的不同价值计数A1 2018) 和类似地,这应该在月的最后一天在月级别上进行切片,反之亦然,适用于周和年。 我在日期维度中有日历层次结构。

最终的结果集应该是这样的:

我已经创建了不同的度量值计数,但这仅适用于日期级别。

请帮忙

【问题讨论】:

    标签: ssas mdx


    【解决方案1】:

    您需要使用带有 Self 标志的后代函数。看看下面的示例

    with member measures.t 
    as 
    (Descendants  ([Date].[Calendar].currentmember,[Date].[Calendar].[Date],SELF).item(Descendants ([Date].[Calendar].currentmember,[Date].[Calendar].[Date],SELF).count-1).item(0)
    ,[Measures].[Internet Sales Amount])
    
    member measures.t1 
    as 
    Descendants  ([Date].[Calendar].currentmember,[Date].[Calendar].[Date],SELF).item(Descendants ([Date].[Calendar].currentmember,[Date].[Calendar].[Date],SELF).count-1).item(0).name
    
    SELECT {measures.t ,measures.t1}
    ON 0 ,
    [Date].[Calendar].[Calendar Year].&[2013]
    on 1 
    FROM [Adventure Works]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多