MDX to drill/get decendents of multiple consolidated elements

Post Reply
initm1
Posts: 32
Joined: Mon Jul 20, 2015 7:19 am
OLAP Product: Microsoft
Version: 10.2
Excel Version: OFFICE365

MDX to drill/get decendents of multiple consolidated elements

Post by initm1 »

Hi, please help me with MDX to drill/get decedents of multiple consolidated elements?
I have a cost center dimension and I want to be able to drill bottom level for 3 of consolidated elements

for single element i use {TM1FILTERBYLEVEL({TM1SUBSETALL( [CostCenter].[CCLV1] )}, 0)}

now i want to do for CCLV1, CCLV5, and CCLV7.

Please help me. Thank you.
TM1.Prespectives.Win7.Office365,Excel2016,Excel2010
tomok
MVP
Posts: 2832
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: MDX to drill/get decendents of multiple consolidated elements

Post by tomok »

UNION.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
User avatar
gtonkin
MVP
Posts: 1202
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: MDX to drill/get decendents of multiple consolidated elements

Post by gtonkin »

Try something like:

Code: Select all

TM1FilterByLevel(Descendants({ [CostCenter].[CCLV1],  [CostCenter].[CCLV5],  [CostCenter].[CCLV7]}),0)
declanr
MVP
Posts: 1815
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: MDX to drill/get decendents of multiple consolidated elements

Post by declanr »

Or to throw in another option:

Code: Select all

{GENERATE({[CostCentre].[BaseSubset]},
{TM1FilterByLevel({TM1DrillDownMember({[CostCentre].CurrentMember},All,Recursive)},0)})}
Where base subset is a subaet containing the 3 elements you mentioned; you can have that one as an MDX subset itself based on any element with an attribute flagged - that way if you need a new element included its simply a case of adding a Y to an attribute.
Declan Rodger
initm1
Posts: 32
Joined: Mon Jul 20, 2015 7:19 am
OLAP Product: Microsoft
Version: 10.2
Excel Version: OFFICE365

Re: MDX to drill/get decendents of multiple consolidated elements

Post by initm1 »

Thanks this is very helpful.
TM1.Prespectives.Win7.Office365,Excel2016,Excel2010
pandinus
Posts: 78
Joined: Tue Mar 18, 2014 8:02 am
OLAP Product: TM1, Cognos Express
Version: 10.2.2
Excel Version: 2013

Re: MDX to drill/get decendents of multiple consolidated elements

Post by pandinus »

This should work too:

Code: Select all

{TM1FILTERBYLEVEL({TM1SUBSETALL( [CostCenter].[CCLV1] )}, 0)}+
{TM1FILTERBYLEVEL({TM1SUBSETALL( [CostCenter].[CCLV5] )}, 0)}+
{TM1FILTERBYLEVEL({TM1SUBSETALL( [CostCenter].[CCLV7] )}, 0)}
initm1
Posts: 32
Joined: Mon Jul 20, 2015 7:19 am
OLAP Product: Microsoft
Version: 10.2
Excel Version: OFFICE365

Re: MDX to drill/get decendents of multiple consolidated elements

Post by initm1 »

All these options works and very helpful. Thanks everyone for helping. Thanks!
TM1.Prespectives.Win7.Office365,Excel2016,Excel2010
User avatar
qml
MVP
Posts: 1094
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1 / Planning Analytics
Version: 2.0.9 and all previous
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: MDX to drill/get decendents of multiple consolidated elements

Post by qml »

UNION is costly because it removes duplicates, so I avoid it if there is no need for that (because there are not going to be any duplicates), especially if the dimension is large.

Pandinus's solution is good and simple. Here is another version of it, with a slightly different notation (a set of sets):

Code: Select all

{ {TM1FILTERBYLEVEL({TM1SUBSETALL( [CostCenter].[CCLV1] )}, 0)},
  {TM1FILTERBYLEVEL({TM1SUBSETALL( [CostCenter].[CCLV5] )}, 0)},
  {TM1FILTERBYLEVEL({TM1SUBSETALL( [CostCenter].[CCLV7] )}, 0)} }
Kamil Arendt
tomok
MVP
Posts: 2832
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: MDX to drill/get decendents of multiple consolidated elements

Post by tomok »

qml wrote:UNION is costly because it removes duplicates, so I avoid it if there is no need for that (because there are not going to be any duplicates), especially if the dimension
Agreed but every other solution given will result in duplicates if any leaf elements are present in one or more of the consolidated nodes. I didn't see anything in the original post to indicate one way or the other whether that was true or not.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
blackhawk
Community Contributor
Posts: 136
Joined: Thu May 29, 2008 2:29 pm

Re: MDX to drill/get decendents of multiple consolidated elements

Post by blackhawk »

Interesting...not sure why someone didn't mention this earlier, but TM1DrillDownMember takes a set as a parameter, so to drill down on multiple elements, why not just use the set notation?

Code: Select all

TM1FilterByLevel(
    TM1DrilldownMember(
        { [CostCenter].[CCLV1],  [CostCenter].[CCLV5],  [CostCenter].[CCLV7] }, 
        ALL, 
        RECURSIVE 
    ),
    0
)
That said though, it doesn't remove duplicates as mentioned by tomok. Duplicates gets into a problem because for some reason TM1's DISTINCT clause doesn't work as expected.
Post Reply