# Cumulative sum on daily basis

**URL:** https://discuss.elastic.co/t/cumulative-sum-on-daily-basis/217168
**Category:** Kibana
**Created:** [January 30, 2020, 11:22am UTC](https://discuss.elastic.co/t/cumulative-sum-on-daily-basis/217168 "2020-01-30T11:22:31Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Purushoth\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/purushoth_kumar/32/54579_2.png) [@Purushoth\_Kumar](https://discuss.elastic.co/u/Purushoth_Kumar)
#### Post date: [January 30, 2020, 11:22am UTC](https://discuss.elastic.co/t/cumulative-sum-on-daily-basis/217168/1 "2020-01-30T11:22:31Z")

</div>

> [@Visualize some kind of rolling sum?](https://discuss.elastic.co/t/visualize-some-kind-of-rolling-sum/195774):
>
> Okay, let's say I'm getting sporadic deliveries of something, approximately every 2-3 hours but sometimes 2 in quick succession, sometimes none for 8 hours, etc. Each time a delivery is made, the amount delivered is put in a document in elasticsearch. Is it possible to create a graph that shows, over time, the sum of the amount of stuff delivered in the 24 hours previous to each point on the graph?

Hi I have a use case where I need to plot cumulative sum of status code count vs time.

But what I except that the cumulative sum will reset to 0 at the day starting (00:00:00).

For example, let say I have 10 count at 10:00, 20 at 15:00...for same day & I have 10 count at 09:00 next day...  
When I plot this data as a cumulative sum I need to have data starting at 0 and ending at 30 at 15:00 for the current day.... And the visualization should start at 0 for next day

---

<div class="post-metadata">

### Author: ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)
#### Post date: [January 31, 2020, 4:55pm UTC](https://discuss.elastic.co/t/cumulative-sum-on-daily-basis/217168/2 "2020-01-31T16:55:11Z")

</div>

Not 100% sure whether I understand your case correctly, but I think you can do this by creating a chart with a cumulative sum on the y axis, an hourly date histogram on the x axis and a split series by daily date histogram on the same field:

 ![Screenshot 2020-01-31 at 17.53.21](https://us1.discourse-cdn.com/elastic/original/3X/1/d/1d6f316577136fa739833f312fd9e37b435b7d08.png)  
 ![Screenshot 2020-01-31 at 17.55.37](https://us1.discourse-cdn.com/elastic/original/3X/3/a/3a9bfa28184c91ea7dec0de833af21cd480d71f1.png)

Each series will only contain data from a single day and a cumulative sum is made over the hours of that day.

---

<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 28, 2020, 4:55pm UTC](https://discuss.elastic.co/t/cumulative-sum-on-daily-basis/217168/3 "2020-02-28T16:55:34Z")

</div>

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