“排名”维度包含多个层次结构错误

时间:2016-02-08 15:20:19

标签: ssas mdx ssas-2008 ssas-2012

WITH 
  MEMBER [Rank] AS 
    Rank
    (
      [All Products].[Group 2].CurrentMember
     ,Order
      (
        [All Products].[Group 2].MEMBERS
       ,[Measures].[test]
      )
    ) 
SELECT 
  [Rank] ON COLUMNS
 ,[All Products].[Group 2].MEMBERS ON ROWS
FROM [cube];

错误:“Rank”维度包含多个层次结构,因此必须明确指定层次结构。 执行完成

1 个答案:

答案 0 :(得分:0)

使用rank的标准方法是在命中等级函数之前对集合进行排序:

WITH 
  SET [OrderedGroup] AS
    Order
      (
        [All Products].[Group 2].MEMBERS
       ,[Measures].[test]
      )
  MEMBER [Rank] AS 
    Rank
    (
      [All Products].[Group 2].CurrentMember
     ,[OrderedGroup] 
    ) 
SELECT 
  [Rank] ON COLUMNS
 ,[All Products].[Group 2].MEMBERS ON ROWS
FROM [cube];

以下是我就Rank撰写的上一篇文章的参考:

Apply RANK function to a set according to alphabetical order