Thanks Declan, it is great your reponse ! i will try it and i will give the feedback later !!
Original Message:
Sent: Fri February 10, 2023 09:52 AM
From: Declan Rodger
Subject: MDX with hierarchy
Hi Duong,
The code example you provided is missing the hierarchy name that George suggested:
{TM1FILTERBYLEVEL( {TM1DRILLDOWNMEMBER( {['|vDim|'].[element_parent]}, ALL, RECURSIVE )}, 0)}
So if you were using the expression in the named hierarchy itself you would need to add to the hierarchy like below:
{TM1FILTERBYLEVEL( {TM1DRILLDOWNMEMBER( {[DimName].[HierarchyName].[element_parent]}, ALL, RECURSIVE )}, 0)}
If you want those leaf elements that are the result to appear in a subset for the base hierarchy e.g. [DimName].[DimName] then you need to get a bit more creative with the MDX and combine Generate and StrToMember to turn the results of the original set (in the alt hierarchy) into Member Unique Name in the default hierarchy.
{Generate( {TM1FILTERBYLEVEL( {TM1DRILLDOWNMEMBER( {[DimName].[HierarchyName].[element_parent]}, ALL, RECURSIVE )}, 0)}, {StrToMember ( "[DimName].[DimName].[" + [DimName].[HierarchyName].CurrentMember.Name + "]" ) })}
------------------------------
Declan Rodger
Technical Director
Spitfire Analytics
Original Message:
Sent: Fri February 10, 2023 09:07 AM
From: Duong DAU
Subject: MDX with hierarchy
Thanks for the reponse George,
{TM1FILTERBYLEVEL( {TM1SUBSETALL( ['|vDim|'].['|vHierarchy|'] )}, 0)} ==> il know it will work for hierarchy type 1 but it will work for hierarchy type 2?
if i want to do a drilldown to an element of virtual hierarchy, the mdx will work when the element is not "exist" in the dimension? (we can see the element of virtual hierarchy only in Exploration view and PAW)
for ex :
{TM1FILTERBYLEVEL( {TM1DRILLDOWNMEMBER( {['|vDim|'].[element_parent]}, ALL, RECURSIVE )}, 0)} ==> what happens if element parent is not exist?
Thanks !
------------------------------
Duong DAU
Consultant EPM Finance Transformation & Performance - Micropole
M +33 (0)7 62 61 85 33
F +33 (0) 4 26 99 60 81
131 Boulevard Stalingrad / 69100 Villeurbanne
Original Message:
Sent: Fri February 10, 2023 08:55 AM
From: George Tonkin
Subject: MDX with hierarchy
For the default hierarchy you do not need to specify it. For other hierarchies, the sets live against those hiearchies and referencing them needs to be explicit e.g.
{TM1FILTERBYLEVEL( {TM1SUBSETALL( ['|vDim|'].['|vHierarchy|'] )}, 0)}
You would also need to look at using the HierarchySubset commands when working with these hierarchies.
------------------------------
George Tonkin
Business Partner
MCI Consultants
Johannesburg
Original Message:
Sent: Fri February 10, 2023 08:45 AM
From: Duong DAU
Subject: MDX with hierarchy
Hi Community,
I have a question about Virtual dimension or Virtual hierarchy or hierarchy
There are 2 types of hierarchy
Type 1: we can see the hierarchy in Architect or dynamique report
Type 2 : we can see the hierarchy only on Exploration view or PAW
This is the type 2 that i want to ask about
i use this MDX to get all element lvl 0 ==> {TM1FILTERBYLEVEL( {TM1SUBSETALL( ['|vDim|'] )}, 0)}
Is there a way to get all element lvl 0 of a virtual hierarchy?
i tried to find a code that can give me all element of a virtual hierarchy but i dont see it, this is why iam thinking about MDX.
https://www.ibm.com/docs/en/planning-analytics/2.0.0?topic=functions-hierarchy-manipulation-turbointegrator
Thank a lot for help !
------------------------------
Duong DAU
Consultant EPM Finance Transformation & Performance - Micropole
M +33 (0)7 62 61 85 33
F +33 (0) 4 26 99 60 81
131 Boulevard Stalingrad / 69100 Villeurbanne
------------------------------