ElementParent rule in Hierarchies

Post Reply
mvaspal
Community Contributor
Posts: 341
Joined: Wed Nov 03, 2010 9:16 pm
OLAP Product: tm1
Version: 10 2 2 - 2.0.5
Excel Version: From 2007 to 2013
Location: Earth

ElementParent rule in Hierarchies

Post by mvaspal »

Hi,
I am trying to write a "% of Parent" -type of rule in an alternative/virtual (not sure what's the official term...) Hierarchy. Here below is a simplified code of this

The rule for the primary/base dimension looks like this, and works fine:

Code: Select all

[Measures: '% of Parent'] = [Measures: 'Gross Sales'] \ DB('Sales',!Version,!Time,ELPAR('Products',!Products,1),'Gross Sales');
Then I have a Hierarchy, called "By Bucket1", here is my try:

Code: Select all

[Measures: '% of Parent in Bucket1'] = [Measures: 'Gross Sales'] \ DB('Sales',!version,!Time,ElementParent('Products','By Bucket1',!Products,1),'Gross Sales');
The rule returns only 0s. Then I created a test S measure, called TestParent:

Code: Select all

[Measures: 'TestParent'] = S:ElementParent('Products','By Bucket1',!Products,1);
This measure correctly displays the element parents in the By Bucket1 hierarchy, and so I am a bit puzzled on what I'm doing wrong in my % of parent rule?

Any help appreciated,
Thank you
Matyas
User avatar
PavoGa
MVP
Posts: 617
Joined: Thu Apr 18, 2013 6:59 pm
OLAP Product: TM1
Version: 10.2.2 FP7, PA2.0.9.1
Excel Version: 2013 PAW
Location: Charleston, Tennessee

Re: ElementParent rule in Hierarchies

Post by PavoGa »

In the DB statement, the argument for the hierarchy element has to be fully qualified:

'dimname:By Bucket1:' | ElementParent('Products','By Bucket1',!Products,1)
Ty
Cleveland, TN
MarenC
Regular Participant
Posts: 350
Joined: Sat Jun 08, 2019 9:55 am
OLAP Product: Planning Analytics
Version: Planning Analytics 2.0
Excel Version: Excel 2016

Re: ElementParent rule in Hierarchies

Post by MarenC »

I was reading that you don't need the dimension qualifier in a DB.

I also read that you shouldn't use the pipe.

'By Bucket1': ElementParent('Products','By Bucket1',!Products,1)

Is this incorrect?

Maren
mvaspal
Community Contributor
Posts: 341
Joined: Wed Nov 03, 2010 9:16 pm
OLAP Product: tm1
Version: 10 2 2 - 2.0.5
Excel Version: From 2007 to 2013
Location: Earth

Re: ElementParent rule in Hierarchies

Post by mvaspal »

Excellent, that's it, thank you for your help!!
mvaspal
Community Contributor
Posts: 341
Joined: Wed Nov 03, 2010 9:16 pm
OLAP Product: tm1
Version: 10 2 2 - 2.0.5
Excel Version: From 2007 to 2013
Location: Earth

Re: ElementParent rule in Hierarchies

Post by mvaspal »

@Maren - your syntax worked too
I guess because in a DB() function, the dimension order is fixed, so no need to qualify it
User avatar
PavoGa
MVP
Posts: 617
Joined: Thu Apr 18, 2013 6:59 pm
OLAP Product: TM1
Version: 10.2.2 FP7, PA2.0.9.1
Excel Version: 2013 PAW
Location: Charleston, Tennessee

Re: ElementParent rule in Hierarchies

Post by PavoGa »

MarenC wrote: Tue Jul 14, 2020 12:29 pm I was reading that you don't need the dimension qualifier in a DB.

I also read that you shouldn't use the pipe.

'By Bucket1': ElementParent('Products','By Bucket1',!Products,1)

Is this incorrect?

Maren
I've not read that on the pipe, but we do use it without any problems. However, I am UP with not using it. I try to avoid it anyway possible. Did not know this particular syntax would work, so thank you for that!
Ty
Cleveland, TN
Post Reply