0

我是 MDX 世界的新手..

我想仅根据 3 行对列进行分组。但是,也需要加入第 4 行。我的查询是:

SELECT 
 (    { 
   [Measures].[Live Item Count] 
          } 
 ) DIMENSION PROPERTIES parent_unique_name ON COLUMNS, 


 Crossjoin(
 crossjoin(

  [Item].[Class].&[Light],
  [Item].[Style].&[Fav]
  [Item].[Season Year].members),
  [Item].[Count].children )    on rows
FROM Cube

输出为:

Light(Row) | FAV(Row) | ALL(Row)  | 16(Row) | 2(col)
Light(Row) | FAV(Row) | ALL(Row)  | 7(Row)  | 1(col)
Light(Row) | FAV(Row) | 2012(Row) | 16(Row)| 2(col)
Light(Row) | FAV(Row) | 2011(Row) | 7(Row) | 1(col)

但是,我希望我的输出显示为:

Light(Row) | FAV(Row) | ALL(Row)  |        | 3(col)
Light(Row) | FAV(Row) | 2012(Row) | 16(Row)| 2(col)
Light(Row) | FAV(Row) | 2011(Row) | 7(Row) | 1(col)

即,我想对前两行进行分组,以使第三列中没有重复的“全部”。

提前致谢

4

2 回答 2

0

试试这个 - 使用关卡名称 Season Year 和属性名称 Season Year 将选择没有 ALL 成员的每个成员:

SELECT 
 (    { 
   [Measures].[Live Item Count] 
          } 
 ) DIMENSION PROPERTIES parent_unique_name ON COLUMNS, 


 Crossjoin(
 crossjoin(

  [Item].[Class].&[Light],
  [Item].[Style].&[Fav]
  [Item].[Season Year].[Season Year].members),
  [Item].[Count].children )    on rows
FROM Cube
于 2012-08-03T21:57:29.663 回答
0

[Item].[Count]如果层次结构中有 All 成员,则可以使用此查询:

SELECT {[Measures].[Live Item Count]} DIMENSION PROPERTIES parent_unique_name ON COLUMNS, 
Crossjoin(
  Crossjoin([Item].[Class].&[Light], [Item].[Style].&[Fav]),
  Union(
    Crossjoin({"All member of [Item].[Season Year]"}, {"All member of [Item].[Count]"}),
    Crossjoin(Except([Item].[Season Year].members, {"All member of [Item].[Season Year]"}), [Item].[Count].children),
  ) ON ROWS
FROM Cube
于 2012-08-10T21:31:15.217 回答