Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
pavanthota
Creator
Creator

Parent - Children Hierarchy

Hi All,

I have the data of Parent and children hierarchy. I have parent and children two columns are there. I have to create the report like below. I am providing the sample data for reference and output for reference.

  • need to find top parent (Parent should have only children and not  having parent to that). 
  • As per data we dint know how many children levels are there for that top parent. Need to find the children's levels dynamical and show the count of all children levels to that top parent.

In sample data I am providing 6 levels of children. In original data levels may increase . Please check and provide the solution to me.

4 Replies
pavanthota
Creator
Creator
Author

Hi All,

I have the data of Parent and children hierarchy. I have parent and children two columns are there. I have to create the report like below. I am providing the sample data for reference and output for reference.

need to find top parent (Parent should have only children and not  having parent to that). 
As per data we dint know how many children levels are there for that top parent. Need to find the children's levels dynamical and show the count of all children levels to that top parent.
In sample data I am providing 6 levels of children. In original data levels may increase . Please check and provide the solution to me.

Thanks,

Pavan

 

 

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Add two rows in your data for A and F and include them in a child field, keep the parent field blank.

Use below script.


HierarchyBelongsTo(Children,Parent,Name,Parent,ParentName,Depth)
LOAD Parent,
Children,
Children as Name
FROM
[C:\Users\Kaushik\Downloads\Demo_Data.xlsx]
(ooxml, embedded labels, table is Test);

See the attachment.

 

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
pavanthota
Creator
Creator
Author

Hi Kaushik,

Thanks for your reply

I cant include top parent in children list.  I have more than 3 millions of data in original table. I am looking for only top parent and it 's children level count.

 

 

Brett_Bleess
Former Employee
Former Employee

Kaushik is spot on I believe, here is a Design Blog post as well, if this does not work, I am not sure it can be done.

https://community.qlik.com/t5/Qlik-Design-Blog/Unbalanced-n-level-hierarchies/ba-p/1474325

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.