我不是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]
我似乎无法在测量中添加“不计算产品来源& [2]”,因为我已经在列上使用了,所以当我执行select时,我不能在行上使用产品源层次结构。
有什么想法吗?
答案 0 :(得分:1)
也许尝试使用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];