# Visualizing a ratio of two aggregations on the Y axis

**URL:** https://discuss.elastic.co/t/visualizing-a-ratio-of-two-aggregations-on-the-y-axis/201874
**Category:** Kibana
**Created:** [October 1, 2019, 10:31pm UTC](https://discuss.elastic.co/t/visualizing-a-ratio-of-two-aggregations-on-the-y-axis/201874 "2019-10-01T22:31:13Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![anikacool.3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anikacool.3/32/55215_2.png) [@anikacool.3](https://discuss.elastic.co/u/anikacool.3)
#### Post date: [October 1, 2019, 10:31pm UTC](https://discuss.elastic.co/t/visualizing-a-ratio-of-two-aggregations-on-the-y-axis/201874/1 "2019-10-01T22:31:13Z")

</div>

I'd like to plot a graph where the X-axis is the timeseries and the Y axis is a ratio of two certain field values (In my case, this is the "availability" metric which is defined as  
sum(response\_code = OK)/sum(response\_code = OK or response\_code = FAIL).

response\_code is the field which is available in the index.  
I am new to Kibana, but it appears that it does not support support custom metric computation.  
Any help?

---

<div class="post-metadata">

### Author: ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)
#### Post date: [October 4, 2019, 11:11am UTC](https://discuss.elastic.co/t/visualizing-a-ratio-of-two-aggregations-on-the-y-axis/201874/2 "2019-10-04T11:11:04Z")

</div>

This should be achievable in TSVB/Visual Builder, using the Math aggregation to calculate that ratio.

---

<div class="post-metadata">

### Author: ![anikacool.3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anikacool.3/32/55215_2.png) [@anikacool.3](https://discuss.elastic.co/u/anikacool.3)
#### Post date: [October 8, 2019, 5:24pm UTC](https://discuss.elastic.co/t/visualizing-a-ratio-of-two-aggregations-on-the-y-axis/201874/3 "2019-10-08T17:24:58Z")

</div>

Could you please explain how do I sum the rows based on a filter (in my case, sum rows where the response code is OK)?

---

<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: [November 5, 2019, 5:37pm UTC](https://discuss.elastic.co/t/visualizing-a-ratio-of-two-aggregations-on-the-y-axis/201874/4 "2019-11-05T17:37:23Z")

</div>

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