dbTalk Databases Forums  

MDX Rank() -- Tied Ranking with decimal values

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


Discuss MDX Rank() -- Tied Ranking with decimal values in the microsoft.public.sqlserver.olap forum.



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

Default MDX Rank() -- Tied Ranking with decimal values - 11-25-2006 , 06:48 AM






I am trying to achieve tied ranking in MDX. It works fine with the
columns whose values are just integers.
e.g. If I rank by 'Value' Field and also set third argument 'Numeric
Expression' for Rank() function as 'Value' Field only i get the
following results.

Desc Value Rank
-------------------------------------------
Item 1 10 1
Item 2 15 2
Item 3 15 2
Item 4 20 4


But having problems when trying to rank on Fields whose values have
decimals on it. I have a calculated member 'CalcValue' in my Cube which
is the result of a division of two members. So I set it's Format String
as '##.0%' so that it's nicely formatted as Percentage for presentation
on the report.

e.g. If I rank by 'CalcValue' Field and also set third argument
'Numeric Expression' for Rank() function as 'CalcValue' Field, i get
the following results.


Desc CalcValue Rank
-------------------------------------------
Item 1 10.6 1
Item 2 15.4 2
Item 3 15.4 3
Item 4 20.5 4

So the tied ranking is not working as expected.

I am wondering what does Rank() function in AS2005 take into
consideration when trying give rank numbers. Is it the value before
formatting with lot of decimal places or the value after formatting. If
it is the value after formatting it should work in my case. I suspect
it is taking the values before formatting and obiviuosly they are not
equal before formatting to get the same ranks in tied ranking.

Did anyone notice such behaviour. Any help is appreciated.

Regards
Raj Chidipudi


Reply With Quote
  #2  
Old   
Ohjoo Kwon
 
Posts: n/a

Default Re: MDX Rank() -- Tied Ranking with decimal values - 11-26-2006 , 08:16 AM






I understand formatted value is just for display. It is not real value.

Ohjoo

"Raj Chidipudi" <chidipudi (AT) gmail (DOT) com> wrote

Quote:
I am trying to achieve tied ranking in MDX. It works fine with the
columns whose values are just integers.
e.g. If I rank by 'Value' Field and also set third argument 'Numeric
Expression' for Rank() function as 'Value' Field only i get the
following results.

Desc Value Rank
-------------------------------------------
Item 1 10 1
Item 2 15 2
Item 3 15 2
Item 4 20 4


But having problems when trying to rank on Fields whose values have
decimals on it. I have a calculated member 'CalcValue' in my Cube which
is the result of a division of two members. So I set it's Format String
as '##.0%' so that it's nicely formatted as Percentage for presentation
on the report.

e.g. If I rank by 'CalcValue' Field and also set third argument
'Numeric Expression' for Rank() function as 'CalcValue' Field, i get
the following results.


Desc CalcValue Rank
-------------------------------------------
Item 1 10.6 1
Item 2 15.4 2
Item 3 15.4 3
Item 4 20.5 4

So the tied ranking is not working as expected.

I am wondering what does Rank() function in AS2005 take into
consideration when trying give rank numbers. Is it the value before
formatting with lot of decimal places or the value after formatting. If
it is the value after formatting it should work in my case. I suspect
it is taking the values before formatting and obiviuosly they are not
equal before formatting to get the same ranks in tied ranking.

Did anyone notice such behaviour. Any help is appreciated.

Regards
Raj Chidipudi




Reply With Quote
  #3  
Old   
Raj Chidipudi
 
Posts: n/a

Default Re: MDX Rank() -- Tied Ranking with decimal values - 11-30-2006 , 05:04 AM



I think you are right Ohjoo.

Looks like AS2005 uses only the actual results of the calculations for
ranking. I had to write a custom library function to calculate and
format ''CalcValue' first then apply rank() function on it.

Raj

Ohjoo Kwon wrote:
Quote:
I understand formatted value is just for display. It is not real value.

Ohjoo

"Raj Chidipudi" <chidipudi (AT) gmail (DOT) com> wrote in message
news:1164458921.075048.138300 (AT) 45g2000cws (DOT) googlegroups.com...
I am trying to achieve tied ranking in MDX. It works fine with the
columns whose values are just integers.
e.g. If I rank by 'Value' Field and also set third argument 'Numeric
Expression' for Rank() function as 'Value' Field only i get the
following results.

Desc Value Rank
-------------------------------------------
Item 1 10 1
Item 2 15 2
Item 3 15 2
Item 4 20 4


But having problems when trying to rank on Fields whose values have
decimals on it. I have a calculated member 'CalcValue' in my Cube which
is the result of a division of two members. So I set it's Format String
as '##.0%' so that it's nicely formatted as Percentage for presentation
on the report.

e.g. If I rank by 'CalcValue' Field and also set third argument
'Numeric Expression' for Rank() function as 'CalcValue' Field, i get
the following results.


Desc CalcValue Rank
-------------------------------------------
Item 1 10.6 1
Item 2 15.4 2
Item 3 15.4 3
Item 4 20.5 4

So the tied ranking is not working as expected.

I am wondering what does Rank() function in AS2005 take into
consideration when trying give rank numbers. Is it the value before
formatting with lot of decimal places or the value after formatting. If
it is the value after formatting it should work in my case. I suspect
it is taking the values before formatting and obiviuosly they are not
equal before formatting to get the same ranks in tied ranking.

Did anyone notice such behaviour. Any help is appreciated.

Regards
Raj Chidipudi



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.