.png)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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;
Accepted Solutions
.png)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
.png)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
