dbTalk Databases Forums  

How to number output rows in a query

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


Discuss How to number output rows in a query in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
madams@lojack.com
 
Posts: n/a

Default How to number output rows in a query - 06-07-2005 , 12:38 PM






I have what I think is a simple request, but cannot find any clear
references on how to meet it.

My users frequently want to pull their sales data with the Geographic
Customer dimension on rows and the time dimension on columns. They
would like to number each of the rows.

My thought was to create a calculated member that I could nest inside
the time dimension (columns) next to the Quantity measure. I am
researching the use of the RANK function, but I can't seem to get
anywhere. Has anyone out there had any luck with this sort of request?

-Maureen Adams


Reply With Quote
  #2  
Old   
Deepak Puri
 
Posts: n/a

Default Re: How to number output rows in a query - 06-07-2005 , 06:31 PM






Does this sample Foodmart MDX query help?

Quote:
With Member [Measures].[RowRank] as
'Rank(StrToSet("Axis(1)").Item(0).Item(0).Dimensio n.CurrentMember,
StrToSet("Axis(1)"))'

select Non Empty CrossJoin([Time].[1997].Children,
{[Measures].[RowRank], [Measures].[Unit Sales]}) on columns,
[Customers].[All Customers].[USA].[OR].Children on rows
from Sales
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


Reply With Quote
  #3  
Old   
Maureen Adams
 
Posts: n/a

Default Re: How to number output rows in a query - 06-08-2005 , 03:31 PM





I think this will help, but excuse my ignorance..I can't just use this
as a calculated member, can I? How do I set it up within the cube?

Maureen Adams

*** Sent via Developersdex http://www.developersdex.com ***

Reply With Quote
  #4  
Old   
Deepak Puri
 
Posts: n/a

Default Re: How to number output rows in a query - 06-08-2005 , 05:37 PM



You should be able to define a [RowRank] calculated member on the
[Measures] dimension, using the Cube Editor, with the MDX below
(assuming [RowRank] is used as in query):

Quote:
Rank(StrToSet("Axis(1)").Item(0).Item(0).Dimension .CurrentMember,
StrToSet("Axis(1)"))
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


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 - 2013, Jelsoft Enterprises Ltd.