# Delta based on running total

**URL:** <https://discuss.elastic.co/t/delta-based-on-running-total/126169>\
**Category:** Elasticsearch\
**Created:** [March 30, 2018, 12:41am UTC](https://discuss.elastic.co/t/delta-based-on-running-total/126169 "2018-03-30T00:41:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![danfranks](https://avatars.discourse-cdn.com/v4/letter/d/f07891/32.png) [@danfranks](https://discuss.elastic.co/u/danfranks)\
**Post date:** [March 30, 2018, 12:41am UTC](https://discuss.elastic.co/t/delta-based-on-running-total/126169/1 "2018-03-30T00:41:28Z")

</div>

Hello,

I'm a bit new to elastic and am probably missing something simple.

I'm trying to figure out how to display a range of dates with their associated numerical values plus one calculated field that takes the difference between yesterdays totals and today's totals to create a delta that represents the change between the two days.

I've been reading up on the various functions and haven't come across anything to do this yet. Can someone please point me in the right direction?

Thanks in advance,  
Dan

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 30, 2018, 1:43am UTC](https://discuss.elastic.co/t/delta-based-on-running-total/126169/2 "2018-03-30T01:43:25Z")

</div>

I think that you have to use a pipeline aggregation for this.

[https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline.html)

I don't have a concrete example at hand but thought that it could help.

---

<div class="post-metadata">

**Author:** ![danfranks](https://avatars.discourse-cdn.com/v4/letter/d/f07891/32.png) [@danfranks](https://discuss.elastic.co/u/danfranks)\
**Post date:** [March 30, 2018, 3:26am UTC](https://discuss.elastic.co/t/delta-based-on-running-total/126169/3 "2018-03-30T03:26:00Z")

</div>

Thanks! So maybe the Serial Differencing Aggregation?

[https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-serialdiff-aggregation.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-serialdiff-aggregation.html)

I'm trying to find decent examples of it in use to understand it better and determine if it would work.

---

<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 27, 2018, 3:26am UTC](https://discuss.elastic.co/t/delta-based-on-running-total/126169/4 "2018-04-27T03:26:06Z")

</div>

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