Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
saurabh_karlewar
Contributor III
Contributor III

creating a hierarchy structure

Hi,

I am trying to create a hierarchy structure. My sample data is shown in the below table

UserManager
SatishMurali
MuraliJayesh
AbdulJayesh
JayeshVenkat
AartiVenkat

I tried creating a hierarchy  using pivot table, but the structure created is incorrect as the manager name appears in user column.

The expected structure I am looking for is as below with the +/- symbols

VenkatAarti
JayeshAbdul
MuraliSatish

Can someone help me with this?

3 Replies
datanibbler
Champion
Champion

Hi Saurabh,

I cannot quite think it out, but I think you need a LOOP as you will have to go throu all the records several times:

- look for a name (that is not present in the "User" column, so this person does not have a higher manager)

=> Take that name and read all the records where it is in the "Manager" column

    => Read the name(s) in the "User" column

      => Look for this name in the "Manager" column

(LOOP)

HTH

Best regards,

DataNibbler

giakoum
Partner - Master II
Partner - Master II

why not use a hierarchy? check it out in the manual or :

Hierarchies

hic
Former Employee
Former Employee

You should definitely use a Hierarchy prefix:

Hierarchy (UserID, ManagerID, UserName, ManagerName, UserName, Path, '/', Depth)

Load

  User as UserID,

  Manager as ManagerID,

  User as UserName

Inline

[User,Manager

Satish,Murali

Murali,Jayesh

Abdul,Jayesh

Jayesh,Venkat

Aarti,Venkat

Venkat,];

Then you can use the created fields both for a pivot table and a tree-view list box. See more on http://community.qlik.com/blogs/qlikviewdesignblog/2013/11/11/unbalanced-n-level-hierarchies

HIC