mdx statement to determine parent from parallel hierarchy
Posted: Mon Jun 24, 2024 5:56 am
Hi, I need some help with an MDX statement in a subset.
I have already a mdx based subset which shows cost center based on a selection in a web sheet a user can do.
Result are N elements:
AACC/515345
AACC/D515489
AACC/515365
used mdx statement:
TM1FILTERBYLEVEL(DESCENDANTS(NAMETOSET("[Function_M].[" + [zzz_nav_Application].(STRTOMEMBER("[OL_S_Cognos_User].[" + USERNAME + "]"),[zzz_nav_Application].[M],[zzz_nav_Application_object].[Function_M],[zzz_nav_Application_measure].[fav03]) + "]")) , 0)
Based on this list, I need to find now the parent of the N elements from a parallel hierarchy, so not the hierarchy which was selected in the Websheet.
In these parallel hierarchy, the parents always start with "P" + the 6 numbers of the N element from the right.
This means in my example, the outcome should be:
P515345 -> C element, parent of AACC/515345
P515489 -> C element, parent of AACC/D515489
P515365 -> C element, parent of AACC/515365
I already tried with ".ancestors" but this functions only brings the parents of the original selected hierarchy.
I hope someone can help.
I have already a mdx based subset which shows cost center based on a selection in a web sheet a user can do.
Result are N elements:
AACC/515345
AACC/D515489
AACC/515365
used mdx statement:
TM1FILTERBYLEVEL(DESCENDANTS(NAMETOSET("[Function_M].[" + [zzz_nav_Application].(STRTOMEMBER("[OL_S_Cognos_User].[" + USERNAME + "]"),[zzz_nav_Application].[M],[zzz_nav_Application_object].[Function_M],[zzz_nav_Application_measure].[fav03]) + "]")) , 0)
Based on this list, I need to find now the parent of the N elements from a parallel hierarchy, so not the hierarchy which was selected in the Websheet.
In these parallel hierarchy, the parents always start with "P" + the 6 numbers of the N element from the right.
This means in my example, the outcome should be:
P515345 -> C element, parent of AACC/515345
P515489 -> C element, parent of AACC/D515489
P515365 -> C element, parent of AACC/515365
I already tried with ".ancestors" but this functions only brings the parents of the original selected hierarchy.
I hope someone can help.