有两个维度
[record].[record id]
[product].[product name]
[measures].[sales]
我想在记录维度中创建一个新的维度属性。
with member [record].[derived record id] as iif([product].[product name].[product name]
in ('pen', 'eraser', 'notepad'), 0, [record].[record id].[record id])
select [measures].[sales] on 0,
[record].[derived record id].[derived record id] on 1
您看到我正在尝试做的是将产品名称所在的一些行合并到选择列表中,并将其余行保留原样。我可以在加载过程中执行此操作来创建这个新属性,但如何在 MDX 中执行此操作?
提前致谢。
最佳答案
据我了解,您希望有一个 [record].[record id]
层次结构的计算成员,该成员为中的所有度量提供值 0
如果当前产品名称成员是“笔”、“橡皮擦”和“记事本”之一,则为立方体。为此,您可以使用以下 MDX:
with member [record].[record id].[derived record id] -- note: you must name the hierarchy for calculated members
as
IIf([product].[product name].CurrentMember IS [product].[product name].[pen]
or
[product].[product name].CurrentMember IS [product].[product name].[eraser]
or
[product].[product name].CurrentMember IS [product].[product name].[notepad]
,
0
,
Measures.CurrentMember
)
select [measures].[sales]
on 0,
[record].[record id].[derived record id]
on 1
from [YourCube]
关于ssas - 基于另一个维度的 MDX 计算维度成员,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21762601/