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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Aggregating data based on hierarchical levels

Hi

I was wondering if there was a way to sum up values or count values using a hierarchy.

I have a hierarchy structure in my source data with the following structure:

Level1 > Level2> Level3>

Each level will have a set of children associated with it. So :

Level1

> L1Child1

> L1Child2

Level2

>L2Child1

>L2Child2

Level3

>L3Child1

>L3Child2

The branches in the hierarchy tree expand even further where the children branches will have their own branches.

So

Level1

>L1Child1

>>L1SubChild1

I have transactional data with sales data where each record has a SaleID with a Salesperson. Each Salesperson belongs to a specific level in the hierarchy. When a Salesperson moves up or down the hierarchy, his sales move with him.

So my sales data looks like:

SaleIDSales DateSalespersonID
000112/05/20151
000212/05/20152

The hierarchy lookup table looks something like:

Hierarchy LevelParentChild
Level1NULLL1Child1
Level1NULLL1Child2
Level2Level1L2Child1
Level2Level1L2Child2
L1Child1Level1L1Subchild1

The mapping of the salesperson to their respective level looks like this:

SalespersonIDLevel
1Level1
2Level2

Based on the above structures and tables, a direct link between a Salesperson can be done. So when we want to find a count of the number of sales based on the hierarchy level this counts the number of sales for only that level. When Level1 is selected only 1 sale will be counted.

I want to be able to count the number of sales for the direct hierarchy level along with the children underneath.

So for example:

The number of sales for Level 1 should include all sales from Level1 up until the subchild of Level3 when selected in the dashboard. When a user selects Level2 all of the sales for the children and subchildren need to be counted EXCLUDING Level1.

Example:

The above sales tables shows 2 sales for salesperson 1 and 2. When I select Level1 this should calculate 2 sales and and 1 sale.

When I select Level2, this should show only 1 sale.

Can this be done? Are there any good solutions for this?

1 Reply
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Perhaps this discussion helps: Re: BOM Explosion using Hierarchy & HierarchyBelongsTo


talk is cheap, supply exceeds demand