Quantcast
Channel: SQL Server Analysis Services forum
Viewing all articles
Browse latest Browse all 14337

How to apply sorting for each level of a hierarchy?

$
0
0

I'm using SSAS OLAP and I want to apply sorting of the levels of a hierarchy.

I know that I can sort the whole hierarchy via ORDER function (I have some issues when I'm trying to apply DESC sorting on the whole hierarchy), but what I really want to achieve is sorting of a specific level. For example in the [Date].[Calendar] hierarchy (Adventure Works Cube), I want to have ASC sorting of years, DESC sorting of Quarter, ASC sorting of Months, etc. I do not want to break the hierarchy (using BASC or BDESC), I just need them sorted on the same level. Do you have an idea if this is possible at all?

My idea is to sort the levels based on their key, not by the measure. For example if we have the following structure:
-2009
 -Q1
   -Jan
   -Feb
 -Q2
   -May
   -June
-2010
 -Q1
   -Jan
   -Feb
 -Q2
   -May
   -June
I would like to be able to sort the data in the following order (DESC for years, ASC for Quarters, DESC for months):
-2010
 -Q1
   -Feb
   -Jan
 -Q2
   -June
   -May
-2009
 -Q1
   -Feb
   -Jan
 -Q2
   -June
   -May 

Thanks in advance for your help!



Viewing all articles
Browse latest Browse all 14337

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>