Skip to main content
Announcements
Do More with Qlik - Qlik Cloud Analytics Recap and Getting Started, June 19: REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Daniel_Moore
Former Employee
Former Employee

Summing up direct reports in a hierarchy

I'm working on an orgchart and I'm trying to add up the direct reports for each 'node' and all the "direct reports and below" for each node.

I've played around a bit with the script but no luck. Any ideas?

Testing:
HierarchyBelongsTo:
HierarchyBelongsTo(nodeAncestor, parentAncestor, NodeName, ParentId, AncestorName, DepthDiff)
Load
Node AS nodeAncestor,
Node AS NodeName,
ParentId AS parentAncestor
resident Nodes;

1 Solution

Accepted Solutions
Daniel_Moore
Former Employee
Former Employee
Author

An idea from Qlikview - Hierarchy vs Hierarchy belongs to - YouTube Used hierarchy belongs to and created a table of 'managers' in the script so QlikView could count each occurrence.

Num:

LOAD * INLINE [

  NumID,NumName,NumManagerID

  1, George, 0

  2, Sally,1

  3, Frank,1

  4, John,3

  5, Mary,3

  6, Errol,2

];

// Table with entries each time an EmployeeID occurs as a manager.

NoConcatenate

Count:

LOAD

  NumManagerID as EmployeeID,

  1 as MngrCount

Resident Num;

For directs and below I use made empFlag column for each employee and a straight table with: Sum (empFlag).

I've attached the sample - you can also use that sample as scratch when watching: Qlikview - Hierarchy vs Hierarchy belongs to - YouTube

View solution in original post

1 Reply
Daniel_Moore
Former Employee
Former Employee
Author

An idea from Qlikview - Hierarchy vs Hierarchy belongs to - YouTube Used hierarchy belongs to and created a table of 'managers' in the script so QlikView could count each occurrence.

Num:

LOAD * INLINE [

  NumID,NumName,NumManagerID

  1, George, 0

  2, Sally,1

  3, Frank,1

  4, John,3

  5, Mary,3

  6, Errol,2

];

// Table with entries each time an EmployeeID occurs as a manager.

NoConcatenate

Count:

LOAD

  NumManagerID as EmployeeID,

  1 as MngrCount

Resident Num;

For directs and below I use made empFlag column for each employee and a straight table with: Sum (empFlag).

I've attached the sample - you can also use that sample as scratch when watching: Qlikview - Hierarchy vs Hierarchy belongs to - YouTube