dbTalk Databases Forums  

MDX - Sorting output by row header

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


Discuss MDX - Sorting output by row header in the microsoft.public.sqlserver.olap forum.



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

Default MDX - Sorting output by row header - 05-14-2004 , 01:00 PM






Given the following query:

Select Order({CrossJoin({[Customers].[Country].[USA]}, {[Education
Level].[Education Level].Members})}, [Unit Sales], ASC) On Rows,
{[Measures].[MeasuresLevel].[Unit Sales], [Measures].[MeasuresLevel].[Store
Cost], [Measures].[MeasuresLevel].[Store Sales]} On Columns
From [sales]

I would like to order the results in alphabetical order by the row headers.
In other words, I would like to sort first by Country and then by Education
Level. Is this even possible? If I think of the straight SQL equivalent,
you can't order the columns. They just appear in the order you list them in
the SELECT clause. I assume MDX row headers are the same way but I'm hoping
maybe not.

A follow up question is: How do I order a simple set of strings? If I have
4 groups of cities say, I can do the following to get a set of all cities:
{[CityGroup1], [CityGroup2], [CityGroup3], [CityGroup4]}. But how would I
sort the resulting set alphabetically by city name?

Thanks,

Russ



Reply With Quote
  #2  
Old   
Brian Altmann
 
Posts: n/a

Default RE: MDX - Sorting output by row header - 05-14-2004 , 06:06 PM






At first glance, this seem to work

Select Order({CrossJoin({[Customers].[Country].Members}, {[Education Level].[Education Level].Members})} , Customers.name + [Education Level].name, ASC) On Rows
{[Measures].[MeasuresLevel].[Unit Sales], [Measures].[MeasuresLevel].[Store Cost], [Measures].[MeasuresLevel].[Store Sales]} On Column
From [sales

You could solve the Cities problem the same way
HTH
Bria
www.geocities.com/brianaltmann/olap.html

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.