Calculating in a ragged hierarchy?

Highlighted
Community Manager

Calculating in a ragged hierarchy?

Does anyone know how to do a calculation in a ragged hierarchy which returns to the level of the hierarchy?

1 REPLY 1
Highlighted
Community Boss

RE: Calculating in a ragged hierarchy?

Hi Emily, In my example, I am working from a flat version of my ragged hierarchy with a property that contains the parent. I created a module with just that flat list and some line items. The first set of line items "walk out" the hierarchy.  What I mean by this is it uses the PARENT and LOOKUP functions to build out all the parents above each item. Example formula  to putll the items second level parent -   Flat List.'Parent (item)'[LOOKUP: 'Parent 1 (item)'] After you have built out enjoy Parent Lookup line items that your maximum number of levels is set, you can calculate the level of an item. In the images below, the max number of levels was 7.  In order to calculate the Level, just use an IF..Than  statement with  ISNOTBLANK to count backwards from the max level. IF ISNOTBLANK('Parent 7 (item)') THEN 7 ELSE IF ISNOTBLANK('Parent 6 (item)') THEN 6 ELSE IF ISNOTBLANK('Parent 5 (item)') THEN 5 ELSE IF ISNOTBLANK('Parent 4 (item)') THEN 4 ELSE IF ISNOTBLANK('Parent 3 (item)') THEN 3 ELSE IF ISNOTBLANK('Parent 2 (item)') THEN 2 ELSE IF ISNOTBLANK('Parent 1 (item)') THEN 1 ELSE 0 -Chris