2016-06-01 22 views
0

尝试创建要在KPI中使用的计算度量值。度量值应计算运行时间大于7天的所有呼叫(服务台票证)。扩展查询时缓慢MDX计数

使用此查询测试了该查询,该查询运行速度很快(< 3秒)。

WITH MEMBER [Measures].[Count of Calls long runtime] AS   
     Count(
      Filter(
       [Call Details].[Call Number].MEMBERS 
       , [Measures].[Closed Call Run Time (days)] > 7 
      ) 
     ) 
SELECT 
    { 
     [Count of Calls long runtime] 
    } ON 0 
FROM 
    [Business Intelligence] 

但是当添加其他成员查询,突然它永远完成:

WITH MEMBER [Measures].[Count of Calls long runtime] AS   
Count(
    Filter(
     (
      { 
       [Ipc Categorisation].[Categorisation].[Subcategory].&[222] 
       ,[Ipc Categorisation].[Categorisation].[Subcategory].&[484] 
      } 
      , [Call Details].[Call Number].[Call Number].MEMBERS 
     ) 
     , [Measures].[Closed Call Run Time (days)] > 7 
    ) 
) 
SELECT 
    { 
     [Count of Calls long runtime] 
    } ON 0 
    , 
    { 
     [Customer].[Customer].[Customer] 
    } ON 1 
FROM 
    [Business Intelligence] 
WHERE 
    [Date].[Month Calendar].[Year].&[2016] 

应该有大约30000的40来电显示出来,分成50多个客户。

当我将[长时间运行计数]更改为另一个度量(计算的或实际上是表)时,查询运行速度很快。

我想明白为什么会发生这种情况。我能做些什么来解决这个问题?

回答

0

FILTER最好避免。它强制计算在单元格模式下运行。让我们尝试改变计算块计算模式下运行:

WITH MEMBER [Measures].IsGrt7 AS 
IIF 
(
    [Measures].[Closed Call Run Time (days)] > 7, 
    1, 
    NULL 
) 

MEMBER [Measures].[Count of Calls long runtime] AS   
SUM 
    (  
    { 
    [Ipc Categorisation].[Categorisation].[Subcategory].&[222] 
    ,[Ipc Categorisation].[Categorisation].[Subcategory].&[484] 
    } * [Call Details].[Call Number].[Call Number].MEMBERS 
    , 
    [Measures].IsGrt7   
) 

要了解更多关于这个问题,see here

0

也可以尝试使用它送入一个名为设置非空击中计算研究之前:

WITH 
SET [CallNonEmpty] AS 
NONEMPTY(
    { 
     [Ipc Categorisation].[Categorisation].[Subcategory].&[222] 
    ,[Ipc Categorisation].[Categorisation].[Subcategory].&[484] 
    } 
    *[Call Details].[Call Number].[Call Number].MEMBERS 
, [Measures].[Closed Call Run Time (days)] 
) 
MEMBER [Measures].[Count of Calls long runtime] AS 
SUM(
    EXISTING [CallNonEmpty], 
    IIF(
    [Measures].[Closed Call Run Time (days)] > 7 
    ,1 
    ,NULL 
    ) 
)   
SELECT 
    [Count of Calls long runtime] ON 0, 
    [Customer].[Customer].[Customer] ON 1 
FROM [Business Intelligence] 
WHERE 
    [Date].[Month Calendar].[Year].&[2016];