# Operation on sum aggregation output

**URL:** https://discuss.elastic.co/t/operation-on-sum-aggregation-output/149321
**Category:** Kibana
**Created:** [September 20, 2018, 3:41pm UTC](https://discuss.elastic.co/t/operation-on-sum-aggregation-output/149321 "2018-09-20T15:41:14Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![baddy9459](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/baddy9459/32/45740_2.png) [@baddy9459](https://discuss.elastic.co/u/baddy9459)
#### Post date: [September 20, 2018, 3:41pm UTC](https://discuss.elastic.co/t/operation-on-sum-aggregation-output/149321/1 "2018-09-20T15:41:14Z")

</div>

I want to create pie chart in which first i need sum in metric aggregation and after that i need to perform some conversion operation on output of sum.

Is it possible to do operation on output of sum aggregation in kibana?

---

<div class="post-metadata">

### Author: ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)
#### Post date: [September 21, 2018, 7:29pm UTC](https://discuss.elastic.co/t/operation-on-sum-aggregation-output/149321/2 "2018-09-21T19:29:24Z")

</div>

> Is it possible to do operation on output of sum aggregation in kibana?

No, in Kibana, a single-value metric aggregation such as sum is as computed as it will get. Especially for non-timebased information like you'd represent in a pie chart.

Just curious though, if you could do this directly in an Elasticsearch query using something like bucket script aggregation or scripted metric aggregation, what would the query look like?

---

<div class="post-metadata">

### Author: ![baddy9459](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/baddy9459/32/45740_2.png) [@baddy9459](https://discuss.elastic.co/u/baddy9459)
#### Post date: [September 23, 2018, 6:11am UTC](https://discuss.elastic.co/t/operation-on-sum-aggregation-output/149321/3 "2018-09-23T06:11:26Z")

</div>

hey @tsullivan  
if i wrote elasticsearch query for this,  
then is it possible to create visualization based on that query?

---

<div class="post-metadata">

### Author: ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)
#### Post date: [September 24, 2018, 4:34pm UTC](https://discuss.elastic.co/t/operation-on-sum-aggregation-output/149321/4 "2018-09-24T16:34:05Z")

</div>

Hi, currently that is only possible if you create a custom visualization plugin.

We have a blog post on how to do this at: [https://www.elastic.co/blog/developing-new-kibana-visualizations](https://www.elastic.co/blog/developing-new-kibana-visualizations)

However, that information is a bit outdated for now. I have asked others in the team and they suggest referencing the plugin functional tests: [https://github.com/elastic/kibana/tree/master/test/plugin\_functional](https://github.com/elastic/kibana/tree/master/test/plugin_functional)

---

<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 22, 2018, 4:34pm UTC](https://discuss.elastic.co/t/operation-on-sum-aggregation-output/149321/5 "2018-10-22T16:34:05Z")

</div>

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