← aggr operator page · clause/aggr/group_all/quarters_to_years
pandas ✅ · DuckDB ✅
aggr Me_1 := sum ( Me_1 ) group all time_agg ( "A" ), on the quarterly time_period identifier Id_1.
Aggregation: group all "converts the values of an Identifier Component using conversionExpr and keeps all the resulting Identifiers". Time aggregation: in an aggregation "op must not be specified, and the source dataset must have exactly one Identifier of type time, date or time_period", and on time_period "the original period indicator is converted in the target one".
The data points are grouped by the annual Id_1 and by Id_2: (2020A, A) = 1 + 2 = 3, (2021A, A) = 4 and (2020A, B) = 8, where Me_1 may be Integer or Number, by the integer rule of the Sum page. Aggregate invocation marks group all with "This option is deprecated"; the Aggregation page does not.
DS_r := DS_1 [ aggr Me_1 := sum ( Me_1 ) group all time_agg ( "A" ) ];
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 2020Q1 | A | 1 |
| 2020Q2 | A | 2 |
| 2021Q1 | A | 4 |
| 2020Q1 | B | 8 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Time_Period", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 2020A | A | 3 |
| 2021A | A | 4 |
| 2020A | B | 8 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Time_Period", "role": "Identifier"},
{"name": "Id_2", "type": "String", "role": "Identifier"},
{"name": "Me_1", "type": ["Integer", "Number"], "role": "Measure"}
]
}
]
}