MDX - return all root elements
-
- Posts: 4
- Joined: Wed Feb 16, 2011 9:42 am
- OLAP Product: TM1
- Version: 9.5.1
- Excel Version: 2007
MDX - return all root elements
I was just wondering if there's any possiblity to get all root elements?
.members gives me the complete hierarchy back and with filebylevel I need to know the exact level - which can change.
Any other ideas?
.members gives me the complete hierarchy back and with filebylevel I need to know the exact level - which can change.
Any other ideas?
-
- MVP
- Posts: 3701
- Joined: Fri Mar 13, 2009 11:14 am
- OLAP Product: TableManager1
- Version: PA 2.0.x
- Excel Version: Office 365
- Location: Switzerland
Re: MDX - return all root elements
You need to be clear on what exactly you mean by "all root elements". Do you mean ...
- All elements in the dimension? (TM1SubsetAll function)
- All leaf elements? (Nest TM1FilterByLevel with TM1SubsetAll)
- All "root hierarchy" nodes? (that is members with descendants but no ancestors, MDX is more tricky but can also be done.)
- All elements in the dimension? (TM1SubsetAll function)
- All leaf elements? (Nest TM1FilterByLevel with TM1SubsetAll)
- All "root hierarchy" nodes? (that is members with descendants but no ancestors, MDX is more tricky but can also be done.)
- jim wood
- Site Admin
- Posts: 3958
- Joined: Wed May 14, 2008 1:51 pm
- OLAP Product: TM1
- Version: PA 2.0.7
- Excel Version: Office 365
- Location: 37 East 18th Street New York
- Contact:
Re: MDX - return all root elements
Doesn't filtering for all level 0 give all root elements???
Struggling through the quagmire of life to reach the other side of who knows where.
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
-
- MVP
- Posts: 3701
- Joined: Fri Mar 13, 2009 11:14 am
- OLAP Product: TableManager1
- Version: PA 2.0.x
- Excel Version: Office 365
- Location: Switzerland
Re: MDX - return all root elements
Like I said, depends what the OP meant by root element.
- jim wood
- Site Admin
- Posts: 3958
- Joined: Wed May 14, 2008 1:51 pm
- OLAP Product: TM1
- Version: PA 2.0.7
- Excel Version: Office 365
- Location: 37 East 18th Street New York
- Contact:
Re: MDX - return all root elements
Indeed.
Struggling through the quagmire of life to reach the other side of who knows where.
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
-
- MVP
- Posts: 733
- Joined: Wed May 14, 2008 11:06 pm
Re: MDX - return all root elements
andreask wrote:I was just wondering if there's any possiblity to get all root elements?
My read on the OP's question is that he wants all the top-level consolidations:lotsaram wrote:- All "root hierarchy" nodes? (that is members with descendants but no ancestors, MDX is more tricky but can also be done.)
Code: Select all
{Filter(
{TM1SubsetAll([YOUR_DIMENSION_NAME])},
[YOUR_DIMENSION_NAME].CurrentMember.Parent.Name="")
}
Robin Mackenzie
- jim wood
- Site Admin
- Posts: 3958
- Joined: Wed May 14, 2008 1:51 pm
- OLAP Product: TM1
- Version: PA 2.0.7
- Excel Version: Office 365
- Location: 37 East 18th Street New York
- Contact:
Re: MDX - return all root elements
That's very different from most peoples definition of root members??
Struggling through the quagmire of life to reach the other side of who knows where.
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
-
- MVP
- Posts: 733
- Joined: Wed May 14, 2008 11:06 pm
Re: MDX - return all root elements
Jim, interesting... I guess the 'root' is sort of the opposite of the 'leaf' (n-level) if we are talking tree analogies... so I often refer to the top consolidations as root elements.
Robin Mackenzie
- Martin Ryan
- Site Admin
- Posts: 1989
- Joined: Sat May 10, 2008 9:08 am
- OLAP Product: TM1
- Version: 10.1
- Excel Version: 2010
- Location: Wellington, New Zealand
- Contact:
Re: MDX - return all root elements
For what it's worth, if you add in an element into the Dimension Editor with no parent (i.e. top level) then the little dialog box calls the parent "Root"
Please do not send technical questions via private message or email. Post them in the forum where you'll probably get a faster reply, and everyone can benefit from the answers.
Jodi Ryan Family Lawyer
Jodi Ryan Family Lawyer
- jim wood
- Site Admin
- Posts: 3958
- Joined: Wed May 14, 2008 1:51 pm
- OLAP Product: TM1
- Version: PA 2.0.7
- Excel Version: Office 365
- Location: 37 East 18th Street New York
- Contact:
Re: MDX - return all root elements
Martin,
If it has no parent it is the bottom level as well,
Jim.
If it has no parent it is the bottom level as well,
Jim.
Struggling through the quagmire of life to reach the other side of who knows where.
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
- Martin Ryan
- Site Admin
- Posts: 1989
- Joined: Sat May 10, 2008 9:08 am
- OLAP Product: TM1
- Version: 10.1
- Excel Version: 2010
- Location: Wellington, New Zealand
- Contact:
Re: MDX - return all root elements
Yabbut, if it gets children its parent will still be "Root".
Please do not send technical questions via private message or email. Post them in the forum where you'll probably get a faster reply, and everyone can benefit from the answers.
Jodi Ryan Family Lawyer
Jodi Ryan Family Lawyer
- jim wood
- Site Admin
- Posts: 3958
- Joined: Wed May 14, 2008 1:51 pm
- OLAP Product: TM1
- Version: PA 2.0.7
- Excel Version: Office 365
- Location: 37 East 18th Street New York
- Contact:
Re: MDX - return all root elements
Will it though? By putting Root in parent it is actually suggesting it has no parent as it is a root object. This a dialogue box for adding elements. If you insert a child to this it will say the element you first created as a parent. How ever if you select add element instead of insert child the parent will say root. You could argue it's right in both cases. When an element has no parent and is level 0. If it has no parent and is level 6 it is still root, therefore root is neither level 0 or level6, it is any element that has no parent. If we are holding with this definition that is.
Struggling through the quagmire of life to reach the other side of who knows where.
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
-
- MVP
- Posts: 733
- Joined: Wed May 14, 2008 11:06 pm
Re: MDX - return all root elements
Generally, my definition of root element is any consolidation at the top of the hierarchy. I agree, technically speaking, that an orphan n-level is still a root element; and will be picked up by the MDX query I posted above.jim wood wrote:When an element has no parent and is level 0. If it has no parent and is level 6 it is still root, therefore root is neither level 0 or level6, it is any element that has no parent. If we are holding with this definition that is.
The flip-side of this point can be seen when using the following well-known MDX which returns all 0-level elements. As well as all the n-level elements (which is what people generally want) this will also return consolidated elements that have no children:
Code: Select all
{TM1FilterByLevel({TM1SubsetAll([YOUR_DIMENSION_NAME])}, 0)}
I think this conversation just goes to show the subtle differences between the level of an element in a dimension and the definition of n- and c-level elements.
Robin Mackenzie
-
- 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: MDX - return all root elements
In TM1, a root element is any element that doesn't have a parent. It can be either a bottom level element or a consolidation.rmackenzie wrote:Generally, my definition of root element is any consolidation at the top of the hierarchy. I agree, technically speaking, that an orphan n-level is still a root element; and will be picked up by the MDX query I posted above.
- jim wood
- Site Admin
- Posts: 3958
- Joined: Wed May 14, 2008 1:51 pm
- OLAP Product: TM1
- Version: PA 2.0.7
- Excel Version: Office 365
- Location: 37 East 18th Street New York
- Contact:
Re: MDX - return all root elements
So you agree with me then Tomok?
Struggling through the quagmire of life to reach the other side of who knows where.
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
- Michel Zijlema
- Site Admin
- Posts: 712
- Joined: Wed May 14, 2008 5:22 am
- OLAP Product: TM1, PALO
- Version: both 2.5 and higher
- Excel Version: 2003-2007-2010
- Location: Netherlands
- Contact:
Re: MDX - return all root elements
Hi Jim,jim wood wrote:So you agree with me then Tomok?
I thought that the root of something that is not branching out should be called a carrot

Michel
-
- 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: MDX - return all root elements
Yes. I was just boiling down the facts to a simple concise statement.jim wood wrote:So you agree with me then Tomok?