MDX计算速度 - CurrentMember?

时间:2018-01-04 01:19:26

标签: mdx

我仍在掌握MDX,我正在寻求帮助。这是我的MDX查询:

 CREATE MEMBER CURRENTCUBE.[Measures].[Fake]
   AS 
   IIF(
    (
      (
        [Sales Data].[Ship-to No].CurrentMember
       ,[Sales Data].[Price Type].&[Core]
       ,[Measures].[Sales - Local Currency]
      ) 
    / (
        [Sales Data].[Ship-to No].CurrentMember,
        [Sales Data].[Price Type].[(All)].[ALL],
        [Measures].[Sales - Local Currency]
      )
    ) > 0.9 
  ,1 
  ,NULL
  ), 
VISIBLE = 1; 

CREATE MEMBER CURRENTCUBE.[Measures].[Test Calc]
  AS 
  SUM(
     Descendants(
       [Sales Data].[Ship-to No].CurrentMember
      ,[Sales Data].[Ship-to No].[Ship-to No]
     ),
    [Measures].[Fake]
  ), 
VISIBLE = 1; 

SalesData是事实表,基本计算是计算销售额超过价格类型“核心”的90%的客户数量。

查询目前大约需要5秒才能完成,但我认为如果根据http://sqlblog.com/blogs/mosha/archive/2008/07/29/product-volatility-optimizing-mdx-with-mdx-studio.aspx不使用CurrentMember,这可能会更快

但我不知道从哪里开始改变这个,有人能帮助我提高效率吗?

1 个答案:

答案 0 :(得分:0)

如果从第一个小节中删除当前成员会有什么不同吗?

 CREATE MEMBER CURRENTCUBE.[Measures].[Fake]
   AS 
   IIF(
    (
      (
        [Sales Data].[Price Type].&[Core]
       ,[Measures].[Sales - Local Currency]
      ) 
    / (
        [Sales Data].[Price Type].[(All)].[ALL],
        [Measures].[Sales - Local Currency]
      )
    ) > 0.9 
  ,1 
  ,NULL
  ), 
VISIBLE = 1; 

对于您在第二项指标中使用的当前成员,可能现有就足够了:

CREATE MEMBER CURRENTCUBE.[Measures].[Test Calc]
  AS 
  SUM(
    EXISTING [Sales Data].[Ship-to No].[Ship-to No].MEMBERS
    ,[Measures].[Fake]
  ), 
VISIBLE = 1;