Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
shiveshsingh
Master
Master

Hierarchy level delay calculation

Hi All, 

Please help in sorting out one logic.

 

Input data

 

Doc IdFinished GoodComponentLevelCategorysort OrderDelay
11671670Main110
11671681Child212
11671691Child315
11671702Child414
11671712Child59
11671721Child68
11671732Child77
11671742Child88
21671670Main103
21671901Child114
21671911Child127
21671921Child139
21671932Child142
21671942Child154

 

Out Put Data

Doc IdFinished GoodComponentLevelCategorysort OrderDelayLevel DelayTotal Delay
11671670Main1102939
11671681Child212012
11671691Child3151429
11671702Child414014
11671712Child5909
11671721Child68816
11671732Child7707
11671742Child8808
21671670Main1031316
21671901Child11404
21671911Child12707
21671921Child139413
21671932Child14202
21671942Child15404

 

Data Understanding:

Data is doc id and Finished good wise and sorted based on parent child relation ship.

if you look on the levels, you can see the parent child relationship.

 

we have to start from the lowest level of child for a particular doc id and Finished good combination. So sorting is important

Let's check the i/p data.

for doc id = 1 and finished good = 167, lowest sort order is 8, that means it is the lowest level of child.

Now start calculating Level Delay, if there is no level below , it means it is 0. and total delay will be Delay + Level Delay.

This is for child.

If you move, one level up - you can see level as 2, so it is again child and not parent - so total delay = Delay + Level Delay.

moving one level up , level is 1. So this is parent for below 2 levels. Now for this, Level delay will be maximum of Total delay from it's child.

this way, we have to move up in the calculation.

Any help would be appreciated.

1 Reply
shiveshsingh
Master
Master
Author

@sunny_talwar , @Anil_Babu_Samineni  - Please help