# Kibana visualization - Aggregating data for dashboard

**URL:** <https://discuss.elastic.co/t/kibana-visualization-aggregating-data-for-dashboard/356601>\
**Category:** Kibana\
**Tags:** visualisation\
**Created:** [April 2, 2024, 9:08am UTC](https://discuss.elastic.co/t/kibana-visualization-aggregating-data-for-dashboard/356601 "2024-04-02T09:08:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mislav.kuzmic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mislav.kuzmic/32/123985_2.png) [@mislav.kuzmic](https://discuss.elastic.co/u/mislav.kuzmic)\
**Post date:** [April 2, 2024, 9:08am UTC](https://discuss.elastic.co/t/kibana-visualization-aggregating-data-for-dashboard/356601/1 "2024-04-02T09:08:13Z")

</div>

Hello,

we're trying to come up with a dashboard to monitor our services running in a Kubernetes cluster.

We use prometheus to scrape metrics and push them to Elastic Kibana via remove write feature. We managed to get the data into Kibana using an Elastic Agent and prometheus integration policy.

When working on dashboards, we want to aggregate the data that we get from prometheus by a timestamp field.

For example, if we were to create a chart which shows the amount of requests that we received and then break down the data by **Label\_A** (where Lebel\_A is a part of the document), we would need to make a calculation similar to this:

`*sum(counter_value_at_the_end_of_the_date_range) - sum(counter_value_at_the_start_the_date_range)*`

Is something like this possible using visualization library?

Thank you.

---

<div class="post-metadata">

**Author:** ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)\
**Post date:** [April 2, 2024, 9:54am UTC](https://discuss.elastic.co/t/kibana-visualization-aggregating-data-for-dashboard/356601/2 "2024-04-02T09:54:13Z")

</div>

Hi @mislav.kuzmic

the `counter_value_at_the_start_the_date_range` is the complex part.  
The best that is currently possible is to find the difference between the last values of this and the previous time window:

```auto
sum( counter_value ) - sum( counter_value, shift="previous" )

```

---

<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:** [April 30, 2024, 9:54am UTC](https://discuss.elastic.co/t/kibana-visualization-aggregating-data-for-dashboard/356601/3 "2024-04-30T09:54:53Z")

</div>

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