从度量计算中排除维度成员
Excluding dimension members from the measure calculation
我不是 MDX 专家,我有这个简化的查询:
WITH MEMBER [Measures].[SalesCalc] AS
(
[Time Calculations].[Aggregation].&[4]
,[Measures].[Sales]
)
SELECT
[Measures].[SalesCalc]
ON 0
,{
[Product].[Product Source].[Product Source] - [Product].[Product Source].&[2]
} ON 1
FROM [Cube]
计算我的度量(根据现有度量和预先计算的聚合)并显示除一个特定来源之外的所有产品来源。
我的目标是显示所有来源,&[2] 来源应该在那里,但它的度量值应该是 NULL。
所以我想得到类似的东西:
WITH MEMBER [Measures].[SalesCalc] AS
(
[Time Calculations].[Aggregation].&[4]
,[Measures].[Sales]
)
SELECT
[Measures].[SalesCalc] //but for [Product].[Product Source].&[2] this is NULL
ON 0
,
[Product].[Product Source].[Product Source] ON 1
FROM [Cube]
我似乎无法在度量中添加 "do not calculate for product source &[2]" 并且在执行 select 时我无法在行上使用产品源层次结构,因为它已经在列上使用了。
有什么想法吗?
也许可以尝试使用 IIF
WITH
MEMBER [Measures].[SalesCalc] AS
IIF(
[Product].[Product Source].CURRENTMEMBER
IS [Product].[Product Source].[Product Source].&[2]
,NULL
(
[Time Calculations].[Aggregation].&[4]
,[Measures].[Sales]
)
)
SELECT
[Measures].[SalesCalc] ON 0
,[Product].[Product Source].[Product Source] ON 1
FROM [Cube];
我不是 MDX 专家,我有这个简化的查询:
WITH MEMBER [Measures].[SalesCalc] AS
(
[Time Calculations].[Aggregation].&[4]
,[Measures].[Sales]
)
SELECT
[Measures].[SalesCalc]
ON 0
,{
[Product].[Product Source].[Product Source] - [Product].[Product Source].&[2]
} ON 1
FROM [Cube]
计算我的度量(根据现有度量和预先计算的聚合)并显示除一个特定来源之外的所有产品来源。 我的目标是显示所有来源,&[2] 来源应该在那里,但它的度量值应该是 NULL。
所以我想得到类似的东西:
WITH MEMBER [Measures].[SalesCalc] AS
(
[Time Calculations].[Aggregation].&[4]
,[Measures].[Sales]
)
SELECT
[Measures].[SalesCalc] //but for [Product].[Product Source].&[2] this is NULL
ON 0
,
[Product].[Product Source].[Product Source] ON 1
FROM [Cube]
我似乎无法在度量中添加 "do not calculate for product source &[2]" 并且在执行 select 时我无法在行上使用产品源层次结构,因为它已经在列上使用了。
有什么想法吗?
也许可以尝试使用 IIF
WITH
MEMBER [Measures].[SalesCalc] AS
IIF(
[Product].[Product Source].CURRENTMEMBER
IS [Product].[Product Source].[Product Source].&[2]
,NULL
(
[Time Calculations].[Aggregation].&[4]
,[Measures].[Sales]
)
)
SELECT
[Measures].[SalesCalc] ON 0
,[Product].[Product Source].[Product Source] ON 1
FROM [Cube];