dbTalk Databases Forums  

Rank problem in mdx

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Rank problem in mdx in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
shyju
 
Posts: n/a

Default Rank problem in mdx - 07-19-2005 , 02:16 AM






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?

Reply With Quote
  #2  
Old   
SQL McOLAP
 
Posts: n/a

Default RE: Rank problem in mdx - 07-19-2005 , 09:12 AM






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?

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.