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

Creating hierarchical structure

Hi,

I have a table (mt) which is exemplified by the inline load script at the bottom. The table consist of MI (manufactured item) and LPN (local part number), the real data also consist of a few more dimensions. Some of the LPN are shared with the MI column, this is because they are part of a manufactured item sub-assembly. I need to sort this table into a hierarchical structure with sub-assembly levels. Anyone got any smart ideas how to do this? The number of sub-assemblies can vary greatly in the real data so I would prefer a solution that takes that into account.

What expect to get after sorting: 

MISA1SA2LPN
    AA11
    AA12
    AA13
    AA14
    AA15
    AA    AB21
    AA    AB22
    AA    AB23
    AA    AB24
    AA    AB25
    AC31
    AC32
    AC33
    AC34
    BB41
    BB42
    BB43
    BB44
    BB45
    BB    BC51
    BB    BC52
    BB    BC53
    BB    BD61
    BB    BD62
    BB    BD63
    BB    BD64
    BB    BD    BE71
    BB    BD    BE72

What I start with:

mt:

LOAD * INLINE [

    MI, LPN

    AA, 11

    AA, 12

    AA, 13

    AA, 14

    AA, 15

    AA, AB

    AB, 21

    AB, 22

    AB, 23

    AB, 24

    AB, 25

    AC, 31

    AC, 32

    AC, 33

    AC, 34

    BB, 41

    BB, 42

    BB, 43

    BB, 44

    BB, 45

    BB, BC

    BB, BD

    BC, 51

    BC, 52

    BC, 53

    BD, 61

    BD, 62

    BD, 63

    BD, 64

    BD, BE

    BE, 71

    BE, 72

];

Thanks in advance!

Finn

2 Replies
Gysbert_Wassenaar

See these blog posts:

Unbalanced, n-level hierarchies

Bill of Materials


talk is cheap, supply exceeds demand
Not applicable
Author

Thank you for the reply, unfortunately I can not find an answer to my question in those blog posts.

My data is missing the level info that those posts are based on, the level calculation is basically what I'm trying to achieve.