Subtotals and pivots

Hi,
I have an issue in aggregation of a hierarchical tabel and I will simplify the input to give you an idea:

image

Suppose there is a hierarchy with sales. The application and the number of levels is completely different.
I would like to retrieve the following output:

image

So, on every level an aggregation. Since the number of levels is high and simular calculations need to be done on some instances in the flow I do not want to combine the outputs of group by nodes.

Could this be done with the pivoting node (like Excel) or should I use loops with different group selections?
I do not have a lot of experience with loops, so your suggestions are very welcome.

Thanks in advance!
Jan

Hi,

To make sure I’ve got your question perfectly: You want to add a column in which a number starts from 1 and add up with each 1 in sales column. Each time the sales column restarts counting from 1 the level goes higher. Right?

Armin

Hi Armin,

Thank you for reading my question.
KP1 is the highest level, with two members a en b. For a, in this case his subordinate k sold 1, subordinate x from subordinate l sold 2 and a himself sold 3. So, on level 1 the sales of a are 6.
On level 2 it is 1 (subordinate k), 2 (subordinate l) and 3 (no subordinate).
And so on for level 3. The rows with empty elements in the output are less relevant.
I resolved the issue using Python scripts

1 Like