# Is it possible to calculate percent each bucket value represents of the whole?

**URL:** https://discuss.elastic.co/t/is-it-possible-to-calculate-percent-each-bucket-value-represents-of-the-whole/41009
**Category:** Elasticsearch
**Created:** [February 4, 2016, 9:58pm UTC](https://discuss.elastic.co/t/is-it-possible-to-calculate-percent-each-bucket-value-represents-of-the-whole/41009 "2016-02-04T21:58:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![roytmana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/roytmana/32/44855_2.png) [@roytmana](https://discuss.elastic.co/u/roytmana)
#### Post date: [February 4, 2016, 9:58pm UTC](https://discuss.elastic.co/t/is-it-possible-to-calculate-percent-each-bucket-value-represents-of-the-whole/41009/1 "2016-02-04T21:58:06Z")

</div>

I would like to be able to calculate percentage of each bucket's value (bucket value divided by the sum of all buckets values).

For example if I aggregate store sales by store calculating total $ per store and I want it in % of total sales rather than absolute $ values

I was hoping a pipeline aggs would do it for me but it does not seem so. I have not used pipelines before so I may be missing some way of doing it

your suggestion is appreciated  
alex

---

<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: [July 5, 2017, 11:18pm UTC](https://discuss.elastic.co/t/is-it-possible-to-calculate-percent-each-bucket-value-represents-of-the-whole/41009/2 "2017-07-05T23:18:46Z")

</div>


