← count operator page · aggregate/count/ds_group_all/quarters_to_years
pandas ✅ · DuckDB ✅
count with the deprecated group all time_agg ( "A" ), which turns each quarter of Id_2 into its year.
Aggregate invocation: "group all: converts the values of an Identifier Component using conversionExpr and keeps all the resulting Identifiers"; Time aggregation: "On time_period type, the operator maps the input value into the comprising larger time period specified by the periodIndTo parameter".
Id_1, the year and int_var = 2 for A, 2020, A, 2021 and B, 2020.
#1049: over a data set, count gives one Integer measure int_var whatever the operand's measures, and ignores the data points whose measures are all null. With two measures, this settles the conflict between the count page's int_var and the Aggregate invocation's "the resulting Data Set has the same Measures as the operand".
DS_r := count ( DS_1 group all time_agg ( "A" ) );
| 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 | int_var |
|---|---|---|
| A | 2020 | 2 |
| A | 2021 | 2 |
| B | 2020 | 2 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "String", "role": "Identifier"},
{"name": "Id_2", "type": "Time_Period", "role": "Identifier"},
{"name": "int_var", "type": "Integer", "role": "Measure"}
]
}
]
}