Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
#SQLServer 46
SQL Server 44
SSRS EXPERT 41
BI 36
#BI 33
brh 28
SSIS BEST PRACTICES 23
TSQL 19
MS BI STACKS 18
SSRS 17

Archive · View All
March 2011 24
July 2011 17
February 2011 15
April 2010 13
June 2011 11
May 2011 11
April 2011 11
July 2010 11
March 2010 8
December 2011 7

MDX #8 - Why the employee parent-child hierarchy is not sorted

Jun 13 2012 1:47AM by Sherry Li   

Dimension attributes are always pre-sorted

In my previous post, MDX #7 – Get only 10 elements from a MDX query, I mentioned that dimension attributes are always pre-sorted.

This is obvious with the following query.

clip_image001

Parent-child hierarchy is sorted from top to bottom

However, this result does not seem to be sorted in any noticeable order.

clip_image002

Until you realize that the Employees hierarchy in the Employee dimension is a parent-child hierarchy (you can follow this link to see how a typical parent-child hierarchy is constructed:  http://technet.microsoft.com/en-us/library/ms167115.aspx).

clip_image003

The sorting is done from top to bottom. So by default, Jae B. Pak will appear before David R. Campbell, because manager Amy E. Alberts appears before Stephen Y. Jiang.

Now we know that the sorting order is working as expected. But you still want to sort the result alphabetically by employee names.

Use MemberValue function to sort by dimension

The Order function is normally used to sort results by measures. For sorting by dimensions, we can use the Order function and the MemberValue function (or the Member_name) (you can follow this link to see a very good comparison between MemberValue and Member_name and member_key: http://msdn.microsoft.com/en-us/library/ms146082.aspx). Use it as the 2nd parameter for the Order function. 

clip_image004

Change the 3rd parameter from ASC to BASC to break the parent-child hierarchy

The above result is the same as before. Nothing changes. That is because we forgot to tell the MDX engine to break the parent-child hierarchy, and stop sorting from top to bottom.

Changing the 3rd parameter from ASC to BASC will do the trick.

clip_image005

Now the result is sorted alphabetically by employee names, but many of them have no sales.

Let’s add a Non Empty command to the Y axis.

clip_image006

Now we know that a parent-child hierarchy is indeed also pre-sorted, and we also know at least one way now to sort it differently.

Tags: 


Sherry Li
14 · 12% · 3697
1
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

"MDX #8 - Why the employee parent-child hierarchy is not sorted" rated 5 out of 5 by 1 readers
MDX #8 - Why the employee parent-child hierarchy is not sorted , 5.0 out of 5 based on 1 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]