# Plot a table based on aggregate key values

**URL:** <https://discuss.elastic.co/t/plot-a-table-based-on-aggregate-key-values/322635>\
**Category:** Kibana\
**Created:** [January 6, 2023, 6:33pm UTC](https://discuss.elastic.co/t/plot-a-table-based-on-aggregate-key-values/322635 "2023-01-06T18:33:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tukaram](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tukaram/32/118944_2.png) [@Tukaram](https://discuss.elastic.co/u/Tukaram)\
**Post date:** [January 6, 2023, 6:33pm UTC](https://discuss.elastic.co/t/plot-a-table-based-on-aggregate-key-values/322635/1 "2023-01-06T18:33:32Z")

</div>

Hi and HNY!

I am looking to put this kind of data every 30 minutes to Kibana under 1 index.  
data1- {key: 'key1', user: 'A', manager: 'C', cnt1: 2, cnt2:4}  
data2- {key: 'key2', user: 'B', manager: 'C', cnt1: 4, cnt2:5}  
next 30 minute-  
data1- {key: 'key3', user: 'A', manager: 'C', cnt1: 2, cnt2:1}  
data2- {key: 'key4', user: 'B', manager: 'C', cnt1: 2, cnt2:1}

I want to plot aggregate table like -

User |Manager | Count1 | Count2  
A | C | 4 | 5  
B |C | 6 | 6

How I can achieve this? Kibana stack - 7.16.2

---

<div class="post-metadata">

**Author:** ![Stratoula\_Kalafateli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stratoula_kalafateli/32/70923_2.png) [@Stratoula\_Kalafateli](https://discuss.elastic.co/u/Stratoula_Kalafateli)\
**Post date:** [January 9, 2023, 1:37pm UTC](https://discuss.elastic.co/t/plot-a-table-based-on-aggregate-key-values/322635/2 "2023-01-09T13:37:36Z")

</div>

Hey! So if your data look like that:

```auto
{
  "took": 0,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 4,
      "relation": "eq"
    },
    "max_score": 1,
    "hits": [
      {
        "_index": "discuss3",
        "_id": "1",
        "_score": 1,
        "_source": {
          "user": "A",
          "manager": "C",
          "cnt1": 2,
          "cnt2": 4,
          "id": 1
        }
      },
      {
        "_index": "discuss3",
        "_id": "2",
        "_score": 1,
        "_source": {
          "user": "B",
          "manager": "C",
          "cnt1": 4,
          "cnt2": 5,
          "id": 2
        }
      },
      {
        "_index": "discuss3",
        "_id": "3",
        "_score": 1,
        "_source": {
          "user": "B",
          "manager": "C",
          "cnt1": 2,
          "cnt2": 1,
          "id": 3
        }
      },
      {
        "_index": "discuss3",
        "_id": "4",
        "_score": 1,
        "_source": {
          "user": "A",
          "manager": "C",
          "cnt1": 2,
          "cnt2": 1,
          "id": 4
        }
      }
    ]
  }
}

```

then you can accomplish this in lens like that

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/0/202190b4f4270c37ee519cc645466465629def15.png)

---

<div class="post-metadata">

**Author:** ![Tukaram](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tukaram/32/118944_2.png) [@Tukaram](https://discuss.elastic.co/u/Tukaram)\
**Post date:** [January 14, 2023, 9:46am UTC](https://discuss.elastic.co/t/plot-a-table-based-on-aggregate-key-values/322635/3 "2023-01-14T09:46:35Z")

</div>

Thanks a lot for reply.  
I need a table to show value for current day. for current day, I know I can add a custom date field and filter the past day values.  
I am not sure how I can render past values for each selected day(s)

---

<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:** [February 11, 2023, 9:47am UTC](https://discuss.elastic.co/t/plot-a-table-based-on-aggregate-key-values/322635/4 "2023-02-11T09:47:11Z")

</div>

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