我有两个度量:[Measure].[ChildCount] 和 [Measure].[Buyings] 和两个维度:[Buyers] 和 [Sellers]。
[Measure].[ChildCount] 使用 [Buyers] 维度计算每个买家的子组织。[Measure].[Buyings] 使用 [Buyers] 和 [Sellers] 计算从 [Seller] 到 [Buyer] 的购买。
我想要实现的是为 ChildCount < 1 的买家和 ChildCount > 0 的买家选择所有购买。
目前这些查询工作正常:第一个计算每个发件人/买家的购买:
SELECT [Measure].[Buyings] on COLUMNS,
[Sellers].[Code].[Code] *
[Buyers].[Code].[Code] ON ROWS
FROM MyCube
第二个计算有孩子和没有孩子的买家的购买量:
WITH MEMBER [Measure].[BuyingsWithChilds]
as SUM
(
FILTER([Buyers].[Code].[Code],[Measure].[ChildCount]>0),
[Measure].[Buyings]
)
MEMBER [Measure].[BuyingsWithoutChilds]
as SUM
(
FILTER([Buyers].[Code].[Code],[Measure].[ChildCount]<1),
[Measure].[Buyings]
)
SELECT
{
[Measure].[BuyingsWithChilds],
[Measure].[BuyingsWithoutChilds]
} ON COLUMNS,
[Buyers].[Code].[Code] ON ROWS
FROM MyCube
但是,如果我尝试将这些查询组合成所需的查询:
WITH MEMBER [Measure].[BuyingsWithChilds]
as SUM
(
FILTER([Buyers].[Code].[Code],[Measure].[ChildCount]>0),
[Measure].[Buyings]
)
MEMBER [Measure].[BuyingsWithoutChilds]
as SUM
(
FILTER([Buyers].[Code].[Code],[Measure].[ChildCount]<1),
[Measure].[Buyings]
)
SELECT
{
[Measure].[BuyingsWithChilds],
[Measure].[BuyingsWithoutChilds]
} ON COLUMNS,
[Sellers].[Code].[Code] ON ROWS
FROM MyCube
这个查询的执行需要很长时间。是否可以修复或优化此问题?