我需要在上层聚合上层,并过滤来自下层的成员。它用于报告每年的销售额,并在特定月份进行过滤。这是 FoodMart 数据库和具有级别的 Product Dimension 的示例:
- [产品系列]
- 【产品部】
MDX:
WITH
MEMBER [Measures].[Unit Sales Calculated] AS
Aggregate(
Intersect(
Descendants(
[Product].CurrentMember,
[Product].[Product Department],
SELF
),
[Filtered Product Department]
),
[Measures].[Unit Sales]
)
SET [Filtered Product Department] AS
Except(
[Product].[Product Department].Members,
[Product].[Drink].[Alcoholic Beverages]
)
SELECT
NON EMPTY [Measures].[Unit Sales Calculated] ON COLUMNS,
NON EMPTY [Product].[Product Family].Members) ON ROWS
FROM [Sales]
此解决方案有效,但性能相当差。有没有更好的方法来编写这个查询?