使用条件为度量创建缓存

时间:2013-08-11 18:34:36

标签: ssas mdx

如何为度量有条件的查询创建缓存,还有其他更好的方法吗?

每次结果在6秒内恢复,我想让它少于2秒

    WITH MEMBER TotalPaidHigh AS SUM   
(   
Filter (    
     {    
        [Employee].[EmployeeID].Members},   
        [Measures].[Score] <= 4 AND    
           [Measures].[Score] >= 1   
            }   
        ),   
    [Measures].[PaidAmount]    
)
MEMBER TotalPaidLow AS   
(
    ([Measures].[PaidAmount]) - (TotalPaidHigh)   
)   
SELECT   
{    
    TotalPaidHigh, TotalPaidLow   
} ON 0   
FROM     
    [Cube]     
WHERE   
(      
  {   
        [Date].[Month].&[April 2011],   
    [Date].[Month].&[May 2011],    
    [Date].[Month].&[June 2011]    
  }    
  ,[Geography].[State].&[NY]    
)  

1 个答案:

答案 0 :(得分:0)

最好的方法是将PaidHigh定义为多维数据集中的附加物理度量。然后,Analysis Services将缓存该度量的预聚合值,并且只需要对聚合的结果进行最终计算 - 这很快。