Highlighted
Contributor

Query on Parent function

Hi Guys,

 

Curious - Why wont we use Parent(Item('G2 Country')) for line item 3 (Region)?

 

Thanks

 

Screen Shot 2020-05-21 at 9.58.59 PM.png

 

4 REPLIES 4
Highlighted
Community Boss

Re: Query on Parent function

1. The module you shown is dimensioned by G3 Location and not G2 Country.

2. You typically calculate once and reference many times for better performance, ITEM('G2 Country') need not be used when you already have a line item which gives you ITEM('G2 Country')

 

Thanks

Arun

Highlighted
Community Boss

Re: Query on Parent function

because COuntry is already list formated, which is what you get with ITEM, so no need to redo it

Nathan Rudman
Anaplan Model Builder
Highlighted
Contributor

Re: Query on Parent function

Hi @SatyamArora 

 

PARENT function needs list formatted line item / list as its parameter as it basically giving the parent of the list member ,

 

since a line item is already formatted by the G2 country list , i.e (item) so you can directly take parent(g2) to get g1 parent,

 

in case there was not any G2 country line item, you would have to do parent(parent(item(g3)) 

Highlighted
Super Contributor

Re: Query on Parent function

Hi @SatyamArora 

You got excellent responses.
There is a much simpler reason to add to the list of why you should avoid using these "compound" formulas. 

You might want to reference the inner formula (in this case Item () ) from another line item, so if you separate it you will easily have access to it.
Also, it's a matter of getting used to writing a simpler formula for Auditability PLAN.
 Finally, Some functions won't allow you to use a compound formula as a parameter.  For example, you can say 
Source.line item[lookup: parent line item]
where parent line item = PARENT(ITEM(L3)

But you can't write 

Source.line item[lookup: PARENT(ITEM(L3)]

Einas A Ibrahim