MDX,如何展平后代功能的结果

时间:2016-02-19 04:01:18

标签: ssas mdx ssas-tabular

我有一个5级的层次结构,我使用Descendants()来检索成员的所有较低级别。但我最终得到一列结果,我希望得到一个结果,每个级别有一列。所以每一行我都会重复当前成员的父母,祖父母等。

WITH 
  MEMBER [Measures].[key] AS 
    [DimGLAcct].[MgtCOA].CurrentMember.UNIQUENAME 
  MEMBER [Measures].[level_] AS 
    [DimGLAcct].[MgtCOA].CurrentMember.level.ordinal 
SELECT 
  { 
    [Measures].[key]
  , [Measures].[level_]
  , [Measures].[Actuals] 
  } ON COLUMNS, 
  { 
    Descendants(
      [DimGLAcct].[MgtCOA].[Mparent5].&[MCOA].&[400000M - Total operating overhead expenses].&[440000M - Other expenses].&[441000M - Other expenses]
      ,
      ,SELF_AND_AFTER
     ) 
  } ON ROWS 
FROM [Model];

1 个答案:

答案 0 :(得分:0)

我不能完全理解你的关卡的名称,但可以在mdx中执行以下操作:

WITH 
  MEMBER [Measures].[key] AS 
    [DimGLAcct].[MgtCOA].CurrentMember.UNIQUENAME 
  MEMBER [Measures].[level_] AS 
    [DimGLAcct].[MgtCOA].CurrentMember.level.ordinal 
SELECT 
  { 
    [Measures].[key]
  , [Measures].[level_]
  , [Measures].[Actuals] 
  } ON COLUMNS, 

  [DimGLAcct].[LevelX]
 *[DimGLAcct].[LevelY]
 *[DimGLAcct].[LevelZ]
 *[DimGLAcct].[LevelK]

   ON ROWS 
FROM [Model];

用户层次结构中的每个级别都有各自的属性库 - 在上面使用。