3 Replies Latest reply: May 24, 2016 7:46 AM by Sangram Reddy RSS

    Create a hierarchy drill-down application

    Xavier Hahn

      Hi,

       

      I'm relatively new to qlik sense, and I'm tasked with creating an application that will allow the user to see the hierarchy of people directly rattached to him, but with numbers aggregated within all the children of this hierarchy.

       

      To simplify, I've tried creating a minimal example with a sample hierarchy. The hierarchy is defined as follow:

      sample hierarchy.png

      I've generated a simple load script that loads this data into a hierarchy model for unbalanced n-level hierarchy. (took from this document).

       

      Here's the script:

       

      Organization:
      LOAD * INLINE [
        User_Id,name,managerId
        1,Beverly Heath,0
        2,Tate Ochoa,1
        3,Velma Finley,1
        4,Calvin Parker,3
        5,Maxine Medina,3
        6,Wylie Robinson,1
        7,Mercedes Love,2
        8,Beau Rivers,6
        9,Wanda Kelly,2
        10,Buckminster Shelton,4
        ];

      [Nodes]:
      Hierarchy(User_Id, Manager_Id, Node, NodeParent, Node, NodePath, '/', NodeDepth) load
      User_Id,
      managerId as Manager_Id,
      name as Node
      resident Organization;

      [TreeBridge]:
      HierarchyBelongsTo (User_Id, Manager_Id, NodeName, TreeId, TreeName)
      LOAD User_Id,
        managerId as Manager_Id,
           name as NodeName
      Resident Organization;

      [Trees]:
      Hierarchy(TreeId, TreeParentId, Tree)
      Load User_Id as TreeId,
        managerId as TreeParentId,
           name as Tree
      Resident Organization;

       

      Now, the issue is, I'm trying to, for now, add it to a "cross table" in order to have the drill-down behavior, and simply counting a distinct of the User_Id. I'm adding Node1-4 as the dimension, and remove null values for all.

       

      It seem to work at first, as you can see:

      table.PNG

      But once I start opening a few more path of the hierarchy, it "breaks" and most of the data is deleted, only showing one branch of the hierarchy tree.

      table broken.PNG

      I'm not sure whether this is a bug or something that I'm doing that is utterly wrong?

       

      Thanks