# Performing simple math in Kibana for y-axis

**URL:** <https://discuss.elastic.co/t/performing-simple-math-in-kibana-for-y-axis/54538>\
**Category:** Kibana\
**Created:** [July 1, 2016, 1:45pm UTC](https://discuss.elastic.co/t/performing-simple-math-in-kibana-for-y-axis/54538 "2016-07-01T13:45:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shrewn](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@shrewn](https://discuss.elastic.co/u/shrewn)\
**Post date:** [July 1, 2016, 1:45pm UTC](https://discuss.elastic.co/t/performing-simple-math-in-kibana-for-y-axis/54538/1 "2016-07-01T13:45:31Z")

</div>

Documents that I index into kibana have a field, "action" which can either have a string of the action performed or "no-action".

My x-axis is a histogram on field "age" in each document (multiple documents can have the same value for this field)

For each bucket created, in Kibana I want to graph a metric of :

number of documents having no no-action / total number of documents

How do I go about performing the above summation then division and plot it on kibana (as y axis value)?

---

<div class="post-metadata">

**Author:** ![Khalah\_Jones\_Golden](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/khalah_jones_golden/32/7169_2.png) [@Khalah\_Jones\_Golden](https://discuss.elastic.co/u/Khalah_Jones_Golden)\
**Post date:** [July 1, 2016, 9:18pm UTC](https://discuss.elastic.co/t/performing-simple-math-in-kibana-for-y-axis/54538/3 "2016-07-01T21:18:23Z")

</div>

I believe what you want to do is to use a sub aggregation to split bars, with a filter for "no-action" that should give you what you want.

---

<div class="post-metadata">

**Author:** ![shrewn](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@shrewn](https://discuss.elastic.co/u/shrewn)\
**Post date:** [July 2, 2016, 4:39am UTC](https://discuss.elastic.co/t/performing-simple-math-in-kibana-for-y-axis/54538/4 "2016-07-02T04:39:58Z")

</div>

It would involve a sub aggregation but the end result required that I  
described in the equation is like the example given here -  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-bucket-script-aggregation.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-bucket-script-aggregation.html)

---

<div class="post-metadata">

**Author:** ![Khalah\_Jones\_Golden](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/khalah_jones_golden/32/7169_2.png) [@Khalah\_Jones\_Golden](https://discuss.elastic.co/u/Khalah_Jones_Golden)\
**Post date:** [July 5, 2016, 3:38pm UTC](https://discuss.elastic.co/t/performing-simple-math-in-kibana-for-y-axis/54538/5 "2016-07-05T15:38:18Z")

</div>

Scripted fields is the answer to your conundrum!

They are in settings/indices after you choose a specific index on the left.

---

<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 6, 2017, 1:48pm UTC](https://discuss.elastic.co/t/performing-simple-math-in-kibana-for-y-axis/54538/6 "2017-07-06T13:48:17Z")

</div>

Closed on July 6, 2017, 1:48pm UTC


