【问题标题】:MDX query with nested aggregations具有嵌套聚合的 MDX 查询
【发布时间】:2016-05-10 08:22:59
【问题描述】:
WITH 
  MEMBER [Measures].[newCalculatedMeasure] AS 
    Sum
    (
      Filter
      (
        Descendants
        (
          [Date].[28 Days Month Calendar].CurrentMember
         ,2
         ,LEAVES
        )
       ,
          [Measures].[mymeasure] * 10
        > 
          Avg
          (
            Filter
            (
              Descendants
              (
                [Date].[28 Days Month Calendar].CurrentMember
               ,2
               ,LEAVES
              )
             ,
              [Measures].[mymeasure] > 0
            )
           ,[Measures].[mymeasure]
          )
      )
     ,[Measures].[mymeasure]
    ) 
SELECT 
  [Date].[28 Days Month Calendar].MEMBERS ON 0
 ,[Measures].[newCalculatedMeasure] ON 1
FROM [cube];

上面的查询没有评估内部平均函数,而如果我用实际平均值替换它,它的工作正常

有人可以告诉我上述措施有什么问题吗..

【问题讨论】:

    标签: mdx msas


    【解决方案1】:

    将度量拆分为命名集是否有助于解决此上下文问题?

    WITH 
      SET [MYSET] AS 
        Descendants
        (
          [Date].[28 Days Month Calendar].CurrentMember
         ,2
         ,LEAVES
        ) 
      SET [MYSETFILTERED] AS 
        Filter
        (
          [MYSET]
         ,
          [Measures].[mymeasure] > 0
        ) 
      MEMBER [Measures].[newCalculatedMeasure] AS 
        Sum
        (
          Filter
          (
            [MYSET]
           ,
            [Measures].[mymeasure] * 10 > Avg([MYSETFILTERED],[Measures].[mymeasure])
          )
         ,[Measures].[mymeasure]
        ) 
    SELECT 
      [Date].[28 Days Month Calendar].MEMBERS  ON 0
     ,[Measures].[newCalculatedMeasure] ON 1
    FROM [cube];
    

    具有聚合的命名集有时会影响性能,所以如果上述情况拖慢了一切,请见谅。

    【讨论】:

      猜你喜欢
      • 2013-07-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多