Ssas 基于另一个维度的MDX计算维度成员

Ssas 基于另一个维度的MDX计算维度成员,ssas,mdx,Ssas,Mdx,有两个维度 [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])

有两个维度

[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
您可以看到,我试图做的是将product name位于选择列表中的一些行合并起来,其余的保持原样。我可以在加载过程中这样做来创建这个新属性,但是在MDX中该如何做呢


提前感谢。

据我所知,您希望有一个
[record].[record id]
层次结构的计算成员,在当前产品名成员是“pen”、“橡皮擦”和“notepad”之一的情况下,为多维数据集中的所有度量值提供值
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]