IF ELSE statement for different hierarchy levels

NikolayStarostin
Occasional Contributor

IF ELSE statement for different hierarchy levels

Hi team! I have a question about using IF ELSE statements for different levels of hierarchy. I have hierarchy on level 2 (L2) and level 3 (L3). I also have line items which are calculated for L2 and L3 respectively. I need to create a line item on L3 which goes IF *Item from L3* THEN Line item for L3 ELSE Line item for L2.

 

I managed to do the boolean which shows me if the item is from L3 but I can't manage to create IF ELSE statement due to Level mismatch error.

 

Is there a workaround which can help me to solve this problem?

1 ACCEPTED SOLUTION

Accepted Solutions
MarkWarren
Expert

Re: IF ELSE statement for different hierarchy levels

To reference an item at a higher level, in this case at L2 you need a line item for the parent of L3 so you can do a LOOKUP.
Something like:
IF isL3 THEN 'L3 reference' ELSE 'L2 reference'[LOOKUP: 'L3 Parent']

View solution in original post

5 REPLIES 5
ChrisHeathcote
Community Boss

Re: IF ELSE statement for different hierarchy levels

@NikolayStarostin 

What you are asking for is not possible as the L2 and L3 are different lists and the line item can only be formatted to a single list.

 

You will need two IF THEN ELSE line items; one for each outcomes formatted to the respective list. 

Chris Heathcote
Bedford Consulting

Gold Partner and Regional Partner of the Year 2021, EMEA
abhay.kanik
Regular Contributor

Re: IF ELSE statement for different hierarchy levels

@NikolayStarostin 

 

I suggest to keep the format of line item as text and create a separate line item which will be L3 formatted and use finditem from the text to determine the list item.

 

Thanks

Abhay

MarkWarren
Expert

Re: IF ELSE statement for different hierarchy levels

To reference an item at a higher level, in this case at L2 you need a line item for the parent of L3 so you can do a LOOKUP.
Something like:
IF isL3 THEN 'L3 reference' ELSE 'L2 reference'[LOOKUP: 'L3 Parent']

View solution in original post

NikolayStarostin
Occasional Contributor

Re: IF ELSE statement for different hierarchy levels

@MarkWarren, Thanks a lot! This is something I ended up doing. It's not a perfect solution, but will work for my case

dsoomar002
Certified Master Anaplanner

Re: IF ELSE statement for different hierarchy levels

Hi @NikolayStarostin,

 

Another approach may be using different logic for each level of the hierarchy. There is a bit of a setup process required to deploy this concept...however, I will link an article that explains it a lot better than I could. 

 

https://community.anaplan.com/t5/Best-Practices/Calculating-Levels-in-a-Hierarchy-for-Dashboard-Filt...

 

Let me know if you have any questions. I recently used this myself for a use case.