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

    Create a hierarchy drill-down application



      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:


      LOAD * INLINE [
        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

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

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

      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:


      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?