← analytic_invocation operator page · aggregate/analytic_invocation/partition_by/sum_per_quarter
pandas ✅ · DuckDB ✅
partition by Id_2: the sum of Me_1 in calc over the data points of the same quarter.
Analytic invocation: "The input Data Set is partitioned according to the values of one or more Identifier Components"; with no window clause, the window is the whole partition.
Me_3 = 3 + 4 = 7 for 2020Q1, 1 + 8 = 9 for 2020Q2, 5 for 2021Q1 and 1 for 2021Q2.
DS_r := DS_1 [ calc Me_3 := sum ( Me_1 over ( partition by Id_2 ) ) ];
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| A | 2020Q1 | 3 | 1.500000 |
| A | 2020Q2 | 1 | 3.500000 |
| A | 2021Q1 | 5 | 2.500000 |
| A | 2021Q2 | 1 | 0.500000 |
| B | 2020Q1 | 4 | 6.500000 |
| B | 2020Q2 | 8 | 4.500000 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "Time_Period", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Number", "role": "Measure", "nullable": true},
{"name": "Me_2", "type": "Number", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Me_1 | Me_2 | Me_3 |
|---|---|---|---|---|
| A | 2020Q1 | 3 | 1.500000 | 7 |
| A | 2020Q2 | 1 | 3.500000 | 9 |
| A | 2021Q1 | 5 | 2.500000 | 5 |
| A | 2021Q2 | 1 | 0.500000 | 1 |
| B | 2020Q1 | 4 | 6.500000 | 7 |
| B | 2020Q2 | 8 | 4.500000 | 9 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "String", "role": "Identifier"},
{"name": "Id_2", "type": "Time_Period", "role": "Identifier"},
{"name": "Me_1", "type": "Number", "role": "Measure"},
{"name": "Me_2", "type": "Number", "role": "Measure"},
{"name": "Me_3", "type": "Number", "role": "Measure"}
]
}
]
}