# How to perform divide math operation in elasticsearch SQL

**URL:** <https://discuss.elastic.co/t/how-to-perform-divide-math-operation-in-elasticsearch-sql/218932>\
**Category:** Kibana\
**Tags:** canvas\
**Created:** [February 12, 2020, 9:30am UTC](https://discuss.elastic.co/t/how-to-perform-divide-math-operation-in-elasticsearch-sql/218932 "2020-02-12T09:30:16Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jsanz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsanz/32/53734_2.png) [@jsanz](https://discuss.elastic.co/u/jsanz)\
**Post date:** [February 12, 2020, 10:47am UTC](https://discuss.elastic.co/t/how-to-perform-divide-math-operation-in-elasticsearch-sql/218932/2 "2020-02-12T10:47:58Z")

</div>

Hi @kiran_kumar_sukumar

You can find a similar request [here](https://discuss.elastic.co/t/calculating-purcentage-in-a-metric/211652/2) and in essence, the trick is to split your SQL into two `essql` queries and divide them. Using Canvas from Kibana 7.6 and the sample Flights dataset to get the percentage of canceled trips:

```
filters
| essql 
  query="SELECT count(1) as cnt FROM \"kibana_sample_data_flights\" WHERE Cancelled = true"
| math {string "cnt/" {filters | essql query="SELECT count(1) as cnt FROM \"kibana_sample_data_flights\"" | math "cnt" }}
| formatnumber "0%"
| render

```

Cheers

---

_[View the full topic](https://discuss.elastic.co/t/how-to-perform-divide-math-operation-in-elasticsearch-sql/218932)._
