How to use both HIERARCHIZE and TM1 sort together in MDX

Post Reply
Gurumadheshwaran
Posts: 20
Joined: Thu Sep 29, 2011 4:09 pm
OLAP Product: TM1
Version: 9.5.1 and 9.5.2
Excel Version: 2010

How to use both HIERARCHIZE and TM1 sort together in MDX

Post by Gurumadheshwaran »

Hi,

I am having an dimension with the following structure

All
Aaaa
Bbbbb
Ccccc
Ddddd

It has one parent and all leaf elements

I want the elements to be sorted in descending order with the hierarchy retained(the parent element retained)

I used the following MDX

{ HIERARCHIZE( {TM1SORT( {TM1SUBSETALL( [SubsetName] )}, DESC)} ) }

But it is not working, May i know whether the hierarchize and sort will work together or wont, if not is there any other solution to get this

Regards
Guru
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: How to use both HIERARCHIZE and TM1 sort together in MDX

Post by tomok »

{[All]}+{TM1SORT( {TM1FILTERBYLEVEL( {TM1SUBSETALL( [DimName] )}, 0)}, DESC)}
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
Gurumadheshwaran
Posts: 20
Joined: Thu Sep 29, 2011 4:09 pm
OLAP Product: TM1
Version: 9.5.1 and 9.5.2
Excel Version: 2010

Re: How to use both HIERARCHIZE and TM1 sort together in MDX

Post by Gurumadheshwaran »

tomok wrote:{[All]}+{TM1SORT( {TM1FILTERBYLEVEL( {TM1SUBSETALL( [DimName] )}, 0)}, DESC)}

Thanks tomok,

It worked good, but i complexed it using UNION :D

{UNION({TM1FILTERBYLEVEL( {TM1SUBSETALL( [Dim_name] )}, 1)},
{TM1SORT( {TM1FILTERBYLEVEL( {TM1SUBSETALL( [Dim_name] )}, 0)}, DESC)})}

Thanks again :)
MarenC
Regular Participant
Posts: 436
Joined: Sat Jun 08, 2019 9:55 am
OLAP Product: Planning Analytics
Version: Planning Analytics 2.0
Excel Version: Excel 2016

Re: How to use both HIERARCHIZE and TM1 sort together in MDX

Post by MarenC »

Hi,

from a technical point of view why do I need the curly braces around All but not around the TM1Sort?

{[All]} + TM1SORT( {TM1FILTERBYLEVEL( {TM1SUBSETALL( [DimName] )}, 0)}, DESC)

Union({[All]}, TM1SORT( {TM1FILTERBYLEVEL( {TM1SUBSETALL( [DimName] )}, 0)}, DESC))

Maren
Wim Gielis
MVP
Posts: 3234
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: How to use both HIERARCHIZE and TM1 sort together in MDX

Post by Wim Gielis »

A function that returns a set, does not need additional { } around them.
If, for example, an element is strung together by text, that text needs to be converted into a set (of 1 element here) so it needs { }
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
Post Reply