# Ratio of different event count

**URL:** <https://discuss.elastic.co/t/ratio-of-different-event-count/296976>\
**Category:** Kibana\
**Tags:** lens\
**Created:** [February 11, 2022, 1:18pm UTC](https://discuss.elastic.co/t/ratio-of-different-event-count/296976 "2022-02-11T13:18:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dror\_Tirosh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dror_tirosh/32/98379_2.png) [@Dror\_Tirosh](https://discuss.elastic.co/u/Dror_Tirosh)\
**Post date:** [February 11, 2022, 1:18pm UTC](https://discuss.elastic.co/t/ratio-of-different-event-count/296976/1 "2022-02-11T13:18:13Z")

</div>

I have a log of various event  
I need to find the ratio of "good events" from "bad events". I want to graph it over time.

For the "vertical axis formula", I need something like  
`count(eventName=="bad) / count(eventName=='good') `

How can I do it ? while I can create a global Filter by eventName, I can't find a way to create it inside the axis formula.

---

<div class="post-metadata">

**Author:** ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)\
**Post date:** [February 11, 2022, 1:41pm UTC](https://discuss.elastic.co/t/ratio-of-different-event-count/296976/2 "2022-02-11T13:41:57Z")

</div>

You may find explanation in "Common formulas". `kql` can be used in Formula.

```auto
count(kql='eventName: true ')/count(kql='eventName: false ')

```

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/c/8c993cd5be3acb4f32d58b0fabe453ebc4ece72b.png)

---

<div class="post-metadata">

**Author:** ![Dror\_Tirosh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dror_tirosh/32/98379_2.png) [@Dror\_Tirosh](https://discuss.elastic.co/u/Dror_Tirosh)\
**Post date:** [February 15, 2022, 10:31am UTC](https://discuss.elastic.co/t/ratio-of-different-event-count/296976/3 "2022-02-15T10:31:44Z")

</div>

thanks, that worked great.

---

<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:** [March 15, 2022, 10:32am UTC](https://discuss.elastic.co/t/ratio-of-different-event-count/296976/4 "2022-03-15T10:32:14Z")

</div>

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