dbTalk Databases Forums  

How to write ranking of member using the MDX?

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


Discuss How to write ranking of member using the MDX? in the microsoft.public.sqlserver.olap forum.



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

Default How to write ranking of member using the MDX? - 01-07-2005 , 10:51 PM






Dear all,

I want to sort a list of supplier according to their sales amount in
descending order. Then, the rank of the currentmember is shown as a
calculated member. Does anyone know how to write the MDX?

Thanks!

Polly

Reply With Quote
  #2  
Old   
Martin Mason
 
Posts: n/a

Default Re: How to write ranking of member using the MDX? - 01-08-2005 , 09:15 PM






Create a ordered set. Then create a calculated member using the Rank
function. Here's an example from the Foodmart sample.

WITH SET [Ordered Suppliers] AS '
{ Order( Filter ( { [Customers].[Name].Members }, NOT IsNull(
([Measures].[Store Sales]) )) , ([Customers].CurrentMember,
[Measures].[Store Sales]), DESC) }
'
MEMBER [Measures].[Sales Rank] AS '
Rank ( [Customers].CurrentMember, { [Ordered Suppliers] })
'
SELECT { [Measures].[Store Sales], [Measures].[Sales Rank] } ON COLUMNS,
{ [Ordered Suppliers] } ON ROWS
FROM [Sales]
WHERE ( [Time].[1997])

"Polly" <Polly (AT) discussions (DOT) microsoft.com> wrote

Quote:
Dear all,

I want to sort a list of supplier according to their sales amount in
descending order. Then, the rank of the currentmember is shown as a
calculated member. Does anyone know how to write the MDX?

Thanks!

Polly



Reply With Quote
  #3  
Old   
Polly
 
Posts: n/a

Default Re: How to write ranking of member using the MDX? - 01-10-2005 , 03:00 AM



Thanks! Martin.

"Martin Mason" wrote:

Quote:
Create a ordered set. Then create a calculated member using the Rank
function. Here's an example from the Foodmart sample.

WITH SET [Ordered Suppliers] AS '
{ Order( Filter ( { [Customers].[Name].Members }, NOT IsNull(
([Measures].[Store Sales]) )) , ([Customers].CurrentMember,
[Measures].[Store Sales]), DESC) }
'
MEMBER [Measures].[Sales Rank] AS '
Rank ( [Customers].CurrentMember, { [Ordered Suppliers] })
'
SELECT { [Measures].[Store Sales], [Measures].[Sales Rank] } ON COLUMNS,
{ [Ordered Suppliers] } ON ROWS
FROM [Sales]
WHERE ( [Time].[1997])

"Polly" <Polly (AT) discussions (DOT) microsoft.com> wrote in message
news:AC8E20C2-094F-45E8-A7C1-1F93167620F3 (AT) microsoft (DOT) com...
Dear all,

I want to sort a list of supplier according to their sales amount in
descending order. Then, the rank of the currentmember is shown as a
calculated member. Does anyone know how to write the MDX?

Thanks!

Polly




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.