Sorting hierarchy by an attribute

Post Reply
missspeedy23
Posts: 19
Joined: Wed Sep 28, 2016 1:43 pm
OLAP Product: Cognos TM1
Version: 10.1.1
Excel Version: 2007

Sorting hierarchy by an attribute

Post by missspeedy23 »

Before I created a hierarchy in my dimension the MDX to sort by attribute worked perfectly. I have since created a structure in the dimension and the sort is now being applied to each area of the hierarchy individually. What I need to be able to do is show only the leaf level elements and then sort those by the attribute (so in effect what it did before the hierarchy was created). Is there a way to sort N level elements irresepctive of their parent?

Please see attached document demonstrating the issue.
Attachments
TM1 Sort Issue.docx
(34.86 KiB) Downloaded 475 times
Wim Gielis
MVP
Posts: 3240
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Sorting hierarchy by an attribute

Post by Wim Gielis »

Your screenshots do not match the explanation/code.
If you filter by level 0, how can you have consolidated elements in the subset ?
Otherwise your screenshots are misleading and it will not be easy to help you.
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
missspeedy23
Posts: 19
Joined: Wed Sep 28, 2016 1:43 pm
OLAP Product: Cognos TM1
Version: 10.1.1
Excel Version: 2007

Re: Sorting hierarchy by an attribute

Post by missspeedy23 »

Wim Gielis wrote:Your screenshots do not match the explanation/code.
If you filter by level 0, how can you have consolidated elements in the subset ?
Otherwise your screenshots are misleading and it will not be easy to help you.
I just showed the hierarchy screenshot just to show how it is sorting within each hierarchy rather than ignoring them.

So you can see in the first example "Advisor" has a sort order of 99 and "Admin Support" has a sort order of 0, so in the first screenshot which is the order the MDX is generating, "Advisor" should be at the bottom as 99 is the highest number and "Admin Support" should be at the top. Within the "Other parent" it is sorting in the sort order attribute correctly but it is doing it within each parent, not on the leafs as a whole.
User avatar
gtonkin
MVP
Posts: 1265
Joined: Thu May 06, 2010 3:03 pm
OLAP Product: TM1
Version: Latest and greatest
Excel Version: Office 365 64-bit
Location: JHB, South Africa
Contact:

Re: Sorting hierarchy by an attribute

Post by gtonkin »

Try BASC at the end of your ORDER function instead of ASC.
BR, George.

Learn something new: MDX Views
missspeedy23
Posts: 19
Joined: Wed Sep 28, 2016 1:43 pm
OLAP Product: Cognos TM1
Version: 10.1.1
Excel Version: 2007

Re: Sorting hierarchy by an attribute

Post by missspeedy23 »

gtonkin wrote:Try BASC at the end of your ORDER function instead of ASC.
Perfect! Thanks very much.
Post Reply