具有嵌套聚合的MDX查询

时间:2016-05-10 08:23:00

标签: mdx msas

SELECT SMS.CONTNO AS CONTNUMBER

以上查询不评估内部平均函数,而如果我用实际平均值替换它,其工作正常

有人可以告诉我上述措施有什么不对。

1 个答案:

答案 0 :(得分:0)

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

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];

带有聚合的命名集有时可能会影响性能,所以如果以上内容减慢了一切,请原谅。