← time_agg operator page · time/time_agg/comp/mixed_periods_to_years
pandas ✅ · DuckDB ✅
time_agg("A", Me_1) inside calc, as the page's ds_2 := ds_1[calc Me1 := time_agg(“M”,Me1)], on a quarter, a month and a semester.
Time aggregation: "On time_period type, the operator maps the input value into the comprising larger time period specified by the periodIndTo parameter", and the input duration "can be inferred from the internal representation of the value".
Each value goes to its year, whatever its own indicator: 2010Q2, 2011M07 and 2012S2 give 2010, 2011 and 2012, a Time_Period Me_2, as the operator "returns a scalar of the corresponding type".
DS_r := DS_1[calc Me_2 := time_agg("A", Me_1)];
| Id_1 | Me_1 |
|---|---|
| 1 | 2010Q2 |
| 2 | 2011M07 |
| 3 | 2012S2 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Time_Period", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | 2010Q2 | 2010 |
| 2 | 2011M07 | 2011 |
| 3 | 2012S2 | 2012 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "Time_Period", "role": "Measure"},
{"name": "Me_2", "type": "Time_Period", "role": "Measure"}
]
}
]
}