WINDOW RECIPE - SUM
Hello,
I'm working with the window recipe.
I have one simple dataset and i want compute sum and avg for each group.
In the window definition I set up partitioning by variable "type", and in the window aggregations I choose sum and avg for variable "value". I expect dataiku computed sum and avg for each "type" group (i.e if the rows have the same "type" i expect the same sum), instead it recalculates sum and avg for each row within the group. Can anybody help me? Here's Dataiku output:
TYPE | VALUE | VALUE_avg | VALUE_sum |
A | 2 | 2 | 2 |
A | 3 | 2,5 | 5 |
B | 3 | 3 | 3 |
B | 5 | 4 | 8 |
B | 2 | 3,333333333 | 10 |
C | 5 | 5 | 5 |
Best Answer
-
Hi,
the default for windows it to compute running sums inside each partition. If you want the overall sum and average for each partition, you need to enforce an unbounded window frame: activate the window frame, and make sure neither limit preceding nor limit following are checked
Answers
-
Thank you, it works!!!