# Vega transform dynamic groupby aggregate

**URL:** <https://discuss.elastic.co/t/vega-transform-dynamic-groupby-aggregate/243504>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [August 3, 2020, 6:31am UTC](https://discuss.elastic.co/t/vega-transform-dynamic-groupby-aggregate/243504 "2020-08-03T06:31:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dataplatform12345](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dataplatform12345](https://discuss.elastic.co/u/dataplatform12345)\
**Post date:** [August 3, 2020, 6:31am UTC](https://discuss.elastic.co/t/vega-transform-dynamic-groupby-aggregate/243504/1 "2020-08-03T06:31:24Z")

</div>

Is It possible to keep the groupby field list dynamic in transform type “aggregate” and allow the user to pass one or more fields to groupby operation during usage time ?

---

<div class="post-metadata">

**Author:** ![Michaela\_Krkosova](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michaela_krkosova/32/46926_2.png) [@Michaela\_Krkosova](https://discuss.elastic.co/u/Michaela_Krkosova)\
**Post date:** [August 3, 2020, 1:44pm UTC](https://discuss.elastic.co/t/vega-transform-dynamic-groupby-aggregate/243504/2 "2020-08-03T13:44:21Z")

</div>

Hi  
I solved similar problem with creating multiple data sources with type as formula column, then filter it based on signal input:

```
signals: [
    {
      name: Zobrazení
      value: Celkově
      bind: {
        input: radio
        options: ["Celkově", "Po zaměstnancích"]
      }
]
...
 {
  name: table_zam
  source: ["funkce_zam"]
  transform: [...
    {type: "formula", expr: "('Po zaměstnancích')", as: "tab"}
  ]
}
{
  name: table_all
  source: ["funkce_all"]
  transform: [...
  {type: "formula", expr: "('Celkově')", as: "tab"}
  ]
}
 {
      name: table
      source: ["table_all", "table_zam"]
      transform: [
        {type: "filter", expr: "datum.tab === Zobrazení"}
      ]
    } 

```

Misa

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 31, 2020, 1:44pm UTC](https://discuss.elastic.co/t/vega-transform-dynamic-groupby-aggregate/243504/3 "2020-08-31T13:44:22Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
