# Visualizing the ratio of a boolean

**URL:** <https://discuss.elastic.co/t/visualizing-the-ratio-of-a-boolean/157288>\
**Category:** Kibana\
**Created:** [November 19, 2018, 7:45am UTC](https://discuss.elastic.co/t/visualizing-the-ratio-of-a-boolean/157288 "2018-11-19T07:45:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Be\_eri](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@Michael\_Be\_eri](https://discuss.elastic.co/u/Michael_Be_eri)\
**Post date:** [November 19, 2018, 7:45am UTC](https://discuss.elastic.co/t/visualizing-the-ratio-of-a-boolean/157288/1 "2018-11-19T07:45:33Z")

</div>

I'm using the sample flights data from the Kibana tutorials, Each log has a **'carrier'** field (one of 4 string values), and a **'cancelled'** field (boolean)

I want to visualize the percentage of cancelled flights per carrier.  
I tried using a table and do the initial buckets according to carrier and then sub bucket according to cancelled, with a count metric i get the amount of cancelled and not-cancelled flights per carrier

 ![31](https://us1.discourse-cdn.com/elastic/original/3X/3/f/3f71d980952efc5c46058df2481fe88e224c5258.png)

however i can't find a way to add the cancelled/not-cancelled ratio  
I read about painless scripting language but it seems you can use it to access document values but not my calculated metrics

---

<div class="post-metadata">

**Author:** ![thomasneirynck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomasneirynck/32/23313_2.png) [@thomasneirynck](https://discuss.elastic.co/u/thomasneirynck)\
**Post date:** [November 19, 2018, 5:16pm UTC](https://discuss.elastic.co/t/visualizing-the-ratio-of-a-boolean/157288/2 "2018-11-19T17:16:54Z")

</div>

@Michael_Be_eri,

that can be done using bucket scripts. There are only supported in the time series visual builder-visualization.

This is a known outstanding improvement for Kibana: [https://github.com/elastic/kibana/issues/4707](https://github.com/elastic/kibana/issues/4707)

---

<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:** [December 17, 2018, 5:16pm UTC](https://discuss.elastic.co/t/visualizing-the-ratio-of-a-boolean/157288/3 "2018-12-17T17:16:55Z")

</div>

Closed on December 17, 2018, 5:16pm UTC

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