← count operator page · aggregate/count/count_in_having/manual_ex_2

Manual example 2 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

count ( ) without operand in a having condition.

Manual:

Counting the number of data points, Example 2, output verbatim; the Aggregate invocation: "The count operator is used in a havingCondition without parameters".

Expected:

2011 has 3 data points and is kept, 2012 has 2 and is dropped: int_var = 3 for 2011. With one measure and no null, #1049 gives the same output.

script.vtl ⇩

DS_r := count ( DS_1 group by Id_1 having count() > 2 );

input/DS_1.csv ⇩

Id_1Id_2Id_3Me_1
2011AXXiii
2011AYYjjj
2011BYYiii
2012AXXkkk
2012BYYiii

input/DS_1.json ⇩

{
  "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": "Id_3", "type": "String", "role": "Identifier", "nullable": false},
        {"name": "Me_1", "type": "String", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1int_var
20113

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Id_1", "type": "Time_Period", "role": "Identifier"},
        {"name": "int_var", "type": "Integer", "role": "Measure"}
      ]
    }
  ]
}