← count operator page · aggregate/count/ds_having/one_measure

One measure 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

count with the having of Two measures, on a single-measure operand: the shared input without Me_2.

Manual:

Aggregate invocation: "only groups for which havingCondition evaluates to true appear in the result"; the page does not restrict having to single-measure operands.

Expected:

count ( Me_1 ) > 2 holds for A only, which is kept with int_var = 4. With one measure and no null, #1049 gives the manual's own int_var.

script.vtl ⇩

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

input/DS_1.csv ⇩

Id_1Id_2Me_1
A2020Q13
A2020Q21
A2021Q15
A2021Q21
B2020Q14
B2020Q28

input/DS_1.json ⇩

{
  "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}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1int_var
A4

expected/DS_r.json ⇩

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