Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Reverse Hierarchy

I am trying to create both the normal hierarchy and the reverse hierarchy for a tree where not every leaf is equidistant to the root. Take for example a family tree where not every cousin has children. The hierarchy function works well to create the normal hierarchy like this:

grandparent, parent1, child1 depth=3

grandparent, parent1, child2, depth=3

grandparent, parent1, -, depth =2

grandparent1, parent2, - depth=2

grandparent, -, -, depth=1

Now I'm looking to create the reverse hierarch that looks

child1, parent1, grandparent

child2, parent2, grandparent

parent1, grandparent, -

parent2, grandparent, -

grandparent, -,-

I can't just use the hierarchy function reversing who is parent and child because I mistaken end up with lots of roots instead of just one. I can't just reverse the order of fields because some fields are null. My best guess about how to do this is to use the depth information to conditionally load fields. In order to do that elegantly, I need to use the value in the field 'Depth' to determine which fields to load. Can I use a string value as part of a field name in a load statement? Does anyone have any other good ways of going about this?



1 Reply
Not applicable
Author

Use HierarchyBelongsTo