优化 SUM MDX

Optimizing SUM MDX

我有一个大型 MDX 查询,历史上 运行 在 25 秒内;这很好。我最近做了下面概述的更改,运行 时间现在超过 90 秒。

我担心如果我需要执行类似的过滤器,这只会加剧问题。关于如何更有效地为 MDX 执行此类过滤器的任何建议?

// My simple aggregation of all hours runs in 25 seconds
MEMBER [Measures].[Calc_TotalHours] AS
    ([Measures].[PostedHours] + [Measures].[UnpostedHours])

// The same aggregation that excludes a certain type of hours
MEMBER [Measures].[Calc_TotalHours] AS
    SUM ( -{ [Activity].[ProjectCategoryName].&[Overtime] }
             , ([Measures].[ActualHours] + [Measures].[TimeSheetHours_Unposted]) 
        )

我想知道在这里使用 SUM 函数是否有误?

你是对的,Sum() 函数对大集合很重要。尝试重用预先聚合的所有成员:

([Activity].[ProjectCategoryName].[All],[Measures].[ActualHours]) 
+ ([Activity].[ProjectCategoryName].[All],[Measures].[TimeSheetHours_Unposted])
- ([Activity].[ProjectCategoryName].&[Overtime],[Measures].[ActualHours]) 
- ([Activity].[ProjectCategoryName].&[Overtime],[Measures].[TimeSheetHours_Unposted])