It depends on how you use the rank function. If you don't use the calc
expression argument, you'll get what you're showing below, as you've already
stated:
Name Mark Rank
Joe 40 1
Kathe 40 2
Kiran 30 3
If you do use it, you'd get something like:
Name Mark Rank
Joe 40 1
Kathe 40 1
Kiran 30 3
....depending on the tuple you put in the calc expression.
However, if you want:
Name Mark Rank
Joe 40 1
Kathe 40 1
Kiran 30 2
....I really have no idea how to get the native ranking to do that, I'm not
sure it's even possible. I'm not sure if it even makes sense in a
statistical set, but I guess that's in the eye of the business requiring it.
From books online:
Rank
Returns the one-based rank of a specified tuple in a specified set.
Syntax
Rank(«Tuple», «Set»[, «Calc Expression»])
Remarks
If «Calc Expression» is not specified, the Rank function returns the
one-based ordinal position of a tuple, specified in «Tuple», within a set
specified in «Set».
If «Calc Expression» is specified, the Rank function evaluates the numeric
expression specified in «Calc Expression» against the tuple to determine its
one-based rank. When «Calc Expression» is specified, the Rank function
assigns the same rank to tuples in a set with duplicate values. However, the
presence of duplicate values affects the ranks of subsequent tuples in the
set. For example, if the tuple (a,b) had the same value as the tuple (c,d) in
the set {(a,b), (e,f), (c,d)}, and the tuple (a,b) has a rank of 1, then
(a,b) and (c,d) would both have a rank of 1, but (e,f) would have a rank of
3. No tuple would have a rank of 2 in the set.
The Rank function does not order the set.
Example
The following example returns 3:
Rank((c,d), {(a,b), (e,f), (c,d)})
However, if the tuples in the set { (a,b), (e,f), (c,d) } have values of 1,
8, and 3, respectively, in the [Test] measure, the following example returns
2:
Rank ((c,d), {(a,b), (e,f), (c,d)}, Measures.Test)
Good luck.
- Phil
"shyju" wrote:
Quote:
i have a problem with rank function
by using a rank query mdx, it shows the rank as like
(dummy)
Name Mark Rank
Joe 40 1
Kathe 40 2
Kiran 30 3
i want to display same rank for a particular value and the next rank to the
next value. can any one help me to solve this problem? |