根据字母顺序将RANK函数应用于集合

时间:2013-11-12 13:33:28

标签: mdx

是否有可能根据字母顺序创建一个产生集合等级的度量,即Aleen应该是1 .... Zebedie应该排名101(设置有101个项目)

这不起作用:

MEMBER [Measures].[Alphabetic_Rank] AS 
    RANK(
        [CustomerName].CurrentMember,
        ORDER(
            [CustomerName],
            [CustomerName],
            ASC
            )
        )

修改

尝试应用此功能的另一个示例如下,它也不起作用:

WITH 
SET [orderedSet] AS
    ORDER(
    [Operator].members,
    [Operator].currentmember.name,
    BASC
    )
MEMBER [Measures].[newMeasure] AS
    RANK(
    [orderedSet].currentmember, 
    [orderedSet].members
    )
SELECT
   {} ON COLUMNS,
   [orderedSet] 
   * 
   [Measures].[newMeasure] ON ROWS
FROM [ourCube]

1 个答案:

答案 0 :(得分:1)

如何将NAME用作订单的数值:

MEMBER [Measures].[Alphabetic_Rank] AS 
    RANK(
        [CustomerName].CurrentMember,
        ORDER(
            [CustomerName].members,
            [CustomerName].currentMember.NAME,
            BASC
            )
        )

编辑第二部分:

WITH 
SET [orderedSet] AS
    ORDER(
    [Operator].members,
    [Operator].currentmember.name,
    BASC
    )
MEMBER [Measures].[newMeasure] AS
    RANK(
    [Operator].currentmember, 
    [orderedSet]
    )
SELECT
   [Measures].[newMeasure] ON COLUMNS,
   [orderedSet] ON ROWS
FROM [ourCube]