Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
victor5995
Contributor III
Contributor III

How Can I implement Hierarchy Function with my Data

Hello,

I have the data as follow and I am trying to create pivot table with Hierarchical structure.

To make Part A I need Component part of A1, A2, A4, A6 but again to make component part A2 I need A3, to make Component part A4 I need A5 and to make component part A6 I need part A7.

                                                               

PARENT   PART LEVELPARENT OF THIS LEVELCOMPONENT PART

Quantity

A1AA1

1

A1AA21
A2A2A31
A1AA41
A2A4A51
A1AA62
A2A6A72

I want to get output in pivot when I collapse to the lower level something like as below.

PARENT PARTCOMPONENT PARTQuantity
AA11
A21
A31
A41
A52
A62
A72

Appreciate any help and Thanks in Advance.

7 Replies
Gysbert_Wassenaar

See this blog post: Unbalanced, n-level hierarchies. And this document: Hierarchies


talk is cheap, supply exceeds demand
victor5995
Contributor III
Contributor III
Author

Hi Gysbert,

I tried according to the documents provided in above link but can not figure out how to assign the values in Hierarchy syntax as per my data that I represent above.

Hierarchy (NodeID, ParentID, NodeName, [ParentName], [PathSource], [PathName], [PathDelimiter], [Depth])


Can you please help out with how to figure out as per my data which one is NodeID, ParentID,.... and all.

Thanks

cheburashka
Creator III
Creator III

Hello Victor,

Could you provide a csv with the data?

,KR Koen

Not applicable

Hi Victor,

Please check the below one.

Regards,

Sub2u

victor5995
Contributor III
Contributor III
Author

Hi Suba Redy,

How you achieved this on qlikview ?

Thanks

Not applicable

Hi,

Please find the below expression i used in pivot table..

1. Parent

2. =if (Parentofthislevel='A',[ComponentPart],[Parentofthislevel])

3. =if (Parentofthislevel='A2',[ComponentPart],If(Parentofthislevel='A4',[ComponentPart],If(Parentofthislevel='A6',ComponentPart) ) )

Wish U Happy X-Mas and Happy New Year in advance....

Sub2u.

MarcoWedel

Hi,

one solution could be:

QlikCommunity_Thread_146776_Pic1.JPG

tabIn:

LOAD * FROM [http://community.qlik.com/thread/146776] (html, codepage is 1252, embedded labels, table is @1);

Concatenate

LOAD [PARENT OF THIS LEVEL],

    [PARENT OF THIS LEVEL] as [COMPONENT PART]

Resident tabIn

Where not Exists ([COMPONENT PART], [PARENT OF THIS LEVEL]);

tabOut:

Hierarchy ([COMPONENT PART],[PARENT OF THIS LEVEL],[Component Part],,,Path,,Depth)

LOAD *,

    [COMPONENT PART] as [Component Part]

Resident tabIn;

DROP Table tabIn;

hope this helps

regards

Marco