我有一个维度[product].[type]
,其成员包含'Food','Book','Metal','Meat', etc.
我的任务是显示分类维度以将我的销售值分组,例如,将Food & Meat
组归为0
,Metal & Tool
为1
,Book
为2,等等。
我的查询似乎无效:
WITH calculated member [Measures].[Grouped Type] AS
IIF([product].[type].CurrentMember IS [product].[type].[Meat], 0,
IIF([product].[type].CurrentMember IS [product].[type].[Food], 0,
IIF([product].[type].CurrentMember IS [product].[type].[Tool], 1,
...... , 9)))))
SELECT {[Measures].[Sales Amount], [Measures].[Grouped Type].Children} on 0
FROM Cube
WHERE ([Condition])
看起来我的总销售额已显示,但未正确分类。任何帮助?赞赏。
答案 0 :(得分:1)
针对产品维度尝试计算成员,而不是衡量成员:
With
Member [product].[type].[0] as
Sum({[product].[type].[Meat],[product].[type].[Food]})
Member [product].[type].[1] as
Sum({[product].[type].[Tool]})
select
[Measures].[Sales Amount] on 0,
{[product].[type].[0],[product].[type].[1]} on 1
From Cube
Where ([Condition])