0
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];

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

4

1 回答 1

0

The standard way to use rank is to order the set before hitting the rank function:

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];

Here is a reference to a previous post I made concerning Rank:

Apply RANK function to a set according to alphabetical order

于 2016-02-09T08:16:08.793 回答