# Can I create a cumulative average line on visualization?

**URL:** <https://discuss.elastic.co/t/can-i-create-a-cumulative-average-line-on-visualization/92961>\
**Category:** Kibana\
**Created:** [July 13, 2017, 8:26am UTC](https://discuss.elastic.co/t/can-i-create-a-cumulative-average-line-on-visualization/92961 "2017-07-13T08:26:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rkj](https://avatars.discourse-cdn.com/v4/letter/r/a3d4f5/32.png) [@rkj](https://discuss.elastic.co/u/rkj)\
**Post date:** [July 13, 2017, 8:26am UTC](https://discuss.elastic.co/t/can-i-create-a-cumulative-average-line-on-visualization/92961/1 "2017-07-13T08:26:48Z")

</div>

Hi, I'm trying to calculate a cumulative average on visualization but I cant find how.  
For example, if I have a data set like this:

Data= {1, 2, 3, 4, 5} which describes the monthly total number of data

and want to draw a line with data like this:

{1 / 1}  
{( 1 + 2 ) / 2}  
{( 1 + 2 + 3 ) / 3}  
{( 1 + 2 + 3 + 4 ) / 4}  
{( 1 + 2 + 3 + 4 + 5) / 5}

Is this possible?

---

<div class="post-metadata">

**Author:** ![Bargs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bargs/32/5429_2.png) [@Bargs](https://discuss.elastic.co/u/Bargs)\
**Post date:** [July 13, 2017, 4:04pm UTC](https://discuss.elastic.co/t/can-i-create-a-cumulative-average-line-on-visualization/92961/2 "2017-07-13T16:04:41Z")

</div>

I can't think of a way to do this at the moment. The tricky bit is knowing how many buckets to divide by, and I can't find a way to do that purely with aggregations. If there is a way, I suspect it'll be pretty convoluted. However I think it would be pretty trivial to implement on the client side since we already support the cumulative sum aggregation. Feel free to open an enhancement request on the Kibana github repo: [https://github.com/elastic/kibana/issues/new](https://github.com/elastic/kibana/issues/new)

---

<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:** [August 10, 2017, 4:04pm UTC](https://discuss.elastic.co/t/can-i-create-a-cumulative-average-line-on-visualization/92961/3 "2017-08-10T16:04:52Z")

</div>

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