【问题标题】:MDX queries in SSMS vs calculated membersin cubes performanceSSMS 中的 MDX 查询与多维数据集中的计算成员性能
【发布时间】:2016-01-26 14:44:03
【问题描述】:

我有一些带有计算成员的 MDX 查询,而不是在 SSMS 中运行它们时运行得非常快。 但是当我在多维数据集中实现这些计算成员并运行它们时,速度非常慢。 对这种行为有任何想法吗?

这是在 SSMS 中流畅运行的查询,但是当我从 Excel 或 Tableau 查询多维数据集时(针对多维数据集中的相同计算成员),它需要很长时间

with member [Measures].[Sales BUM Avg 3Months] 
as
    sum(  
       lastperiods(3, ancestor([Date].[Calendar].currentMember,[Date].     [Calendar].[Calendar Year Month])), [Measures].[Sales Month BUM]
    )
    /
    count(
       nonempty(lastperiods(3, ancestor([Date].[Calendar].currentMember,[Date].[Calendar].[Calendar Year Month])), [Measures].[Sales Month BUM])
    )    

member [Measures].[CoverageSalesBUM] 
as
  sum([Measures].[Unrestricted BUM])
  /
  sum([Measures].[Sales BUM Avg 3Months] )   

select  non empty { [Measures].[Unrestricted BUM] , [Measures].[Sales BUM Avg 3Months] } on 0 
 ,non empty([Date].[Calendar].[Calendar Date] , [Plant].[Plant].[Plant],[Material].[Material].[Material].[149249] ) on 1
 from [InventCoverage]

【问题讨论】:

  • 也许在多维数据集中创建计算度量后尝试重建聚合。
  • 您能否发布一些示例 MDX 查询以及您添加到多维数据集的相同调用?

标签: ssas mdx


【解决方案1】:

(更多的是代码审查而不是答案,因为我对多维数据集脚本了解不多,因此无法评论您可能需要对多维数据集执行什么操作)

你的第一次计算是不是对函数Avg的重新发明?

在你第二次计算中,你为什么需要申请Sum()?如果这是多维数据集中的聚合集,则无需明确表示Sum。同样显然Divide 是最近才推出的,可能效率更高

WITH 
  MEMBER [Measures].[Sales BUM Avg 3Months] AS 
    Avg
    (
      LastPeriods
      (3
       ,Ancestor
        (
          [Date].[Calendar].CurrentMember
         ,[Date].[Calendar].[Calendar Year Month]
        )
      )
     ,[Measures].[Sales Month BUM]
    ) 
  MEMBER [Measures].[CoverageSalesBUM] AS 
    Divide
    (
      [Measures].[Unrestricted BUM]
     ,[Measures].[Sales BUM Avg 3Months]
    ) 
SELECT 
  NON EMPTY 
    {
      [Measures].[Unrestricted BUM]
     ,[Measures].[Sales BUM Avg 3Months]
    } ON 0
 ,NON EMPTY 
    (
      [Date].[Calendar].[Calendar Date]
     ,[Plant].[Plant].[Plant]
     ,[Material].[Material].[Material].[149249]
    ) ON 1
FROM [InventCoverage];

【讨论】:

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