Data Warehousing and Business Intelligence

21 June 2010

MDX: Sorting

Filed under: Analysis Services,MDX — Vincent Rainardi @ 9:56 pm
Tags: ,

We can sort an axis based on the member on that axis, or on the measure.

Based on the member:                        Based on the measure:

To sort an axis based on the member, we can use the NAME property:

select non empty
order
( {[Customer].[City].[All].Children},
[Customer].[City].CurrentMember.Name, DESC
) on 1,
[Measures].[Internet Sales Amount] on 0
from [Adventure Works];

To sort an axis based on the measure, we use the measure name:

select non empty
order
( {[Customer].[City].[All].Children},
[Measures].[Internet Sales Amount], DESC
) on 1,
[Measures].[Internet Sales Amount] on 0
from [Adventure Works];

Advertisements

1 Comment »

  1. Here are this and some other articles on Sorting dimensional members:

    http://ssas-wiki.com/w/Articles#Sorting_dimensional_members

    Comment by Sam Kane — 16 March 2011 @ 8:13 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: