问题
Is it possible to create a measure that produces the rank of a set according to their alphabetical order i.e. Aleen should be 1 .... Zebedie should be ranked 101 (set has 101 items)
This does not work:
MEMBER [Measures].[Alphabetic_Rank] AS
RANK(
[CustomerName].CurrentMember,
ORDER(
[CustomerName],
[CustomerName],
ASC
)
)
EDIT
A further example of trying to apply this is the following which also does not work:
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:
How about using the NAME as order's numerical value :
MEMBER [Measures].[Alphabetic_Rank] AS
RANK(
[CustomerName].CurrentMember,
ORDER(
[CustomerName].members,
[CustomerName].currentMember.NAME,
BASC
)
)
EDIT for the second part :
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]
来源:https://stackoverflow.com/questions/19930593/apply-rank-function-to-a-set-according-to-alphabetical-order