Bottom-up tree structure cumulative sum
entityid parentid emission percentContribution E1 NULL 30 NULL E2 E1 20 80 E3 E1 10 80 E4 E3 10 80 I have the above tree structure, my goal is to calculate the cumulative sum of each node, with weighted contribution from the children node. I first tried to write a bottom up hierarchical cumulative sum […]
Bottom tree structure cumulative sum
entityid parentid emission percentContribution E1 NULL 30 NULL E2 E1 20 80 E3 E1 10 80 E4 E3 10 80 I have the above tree structure, my goal is to calculate the cumulative sum of each node, with weighted contribution from the children node. I first tried to write a bottom up hierarchical cumulative sum […]
Weighted hierarchical cumulative sum
entityId parentId emission percentContribution cumulativeSum E1 NULL 30 NULL 30 + (28 * 80 / 100) = 52.4 E2 E1 20 80 20 + (10 * 80 / 100) = 28 E3 E2 10 80 10 I don’t know if I’m using the correct terminology, but I’m trying to find the cumulative sum of each […]