← analytic_invocation operator page · aggregate/analytic_invocation/window_default/ties_count_together
pandas ✅ · DuckDB ✅
sum in calc, partitioned by Id_1 and ordered by Id_2, with no window clause, where (A, 1, x) and (A, 1, y) tie on Id_2.
Analytic invocation: with an order clause and no window clause, the default is "range between unbounded preceding and current data point". sdmx-twg/vtl#694 made it the default window of SQL, whose range takes in the data points that tie with the current one on the order keys.
in A (1 and 2 at Id_2 = 1, 3 at 2, 4 at 3), Me_2 is 1 + 2 = 3 on both tied data points, then 6 and 10; in B (5, 6), 5 and 11.
DS_r := DS_1 [ calc Me_2 := sum ( Me_1 over ( partition by Id_1 order by Id_2 ) ) ];
| Id_1 | Id_2 | Id_3 | Me_1 |
|---|---|---|---|
| A | 1 | x | 1 |
| A | 1 | y | 2 |
| A | 2 | x | 3 |
| A | 3 | x | 4 |
| B | 1 | x | 5 |
| B | 2 | x | 6 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Id_3", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Number", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Id_3 | Me_1 | Me_2 |
|---|---|---|---|---|
| A | 1 | x | 1 | 3 |
| A | 1 | y | 2 | 3 |
| A | 2 | x | 3 | 6 |
| A | 3 | x | 4 | 10 |
| B | 1 | x | 5 | 5 |
| B | 2 | x | 6 | 11 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "String", "role": "Identifier"},
{"name": "Id_2", "type": "Integer", "role": "Identifier"},
{"name": "Id_3", "type": "String", "role": "Identifier"},
{"name": "Me_1", "type": "Number", "role": "Measure"},
{"name": "Me_2", "type": "Number", "role": "Measure"}
]
}
]
}