# Aggregate Value based on 2 Date/ time fields

**URL:** https://discuss.elastic.co/t/aggregate-value-based-on-2-date-time-fields/199347
**Category:** Kibana
**Created:** [September 13, 2019, 3:10am UTC](https://discuss.elastic.co/t/aggregate-value-based-on-2-date-time-fields/199347 "2019-09-13T03:10:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![christeven94](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christeven94/32/54121_2.png) [@christeven94](https://discuss.elastic.co/u/christeven94)
#### Post date: [September 13, 2019, 3:10am UTC](https://discuss.elastic.co/t/aggregate-value-based-on-2-date-time-fields/199347/1 "2019-09-13T03:10:52Z")

</div>

Hi I have a data set with 2 different time fields (Start Time and End Time), and 1 count value.

Let Say I have  
Start Time - End Time - Count  
6.00 - 8.00 - 5  
7.00 - 9.00 - 7  
8.00 - 10.00 - 3

And I want to display how much is the sum of count during specific time in ELK:  
Time - Sum  
6.00 - 5  
7.00 - 12  
8.00 - 15  
9.00 - 10  
10.00 - 3

How Can I do that? Thanks

---

<div class="post-metadata">

### Author: ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)
#### Post date: [September 13, 2019, 11:19am UTC](https://discuss.elastic.co/t/aggregate-value-based-on-2-date-time-fields/199347/2 "2019-09-13T11:19:44Z")

</div>

Any solution that we can find to do this in Kibana will be a hacky one. This is not the type of calculation ES is built for.  
If you had a document ingested in ES every time you have something starting and every time it stops, you could do a Diff between cumulative sum of starting and cumulative sum of ending.

---

<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: [October 11, 2019, 11:19am UTC](https://discuss.elastic.co/t/aggregate-value-based-on-2-date-time-fields/199347/3 "2019-10-11T11:19:53Z")

</div>

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