# Divide two columns(generated from aggregations) in data table

**URL:** https://discuss.elastic.co/t/divide-two-columns-generated-from-aggregations-in-data-table/256575
**Category:** Kibana
**Created:** [November 24, 2020, 9:18pm UTC](https://discuss.elastic.co/t/divide-two-columns-generated-from-aggregations-in-data-table/256575 "2020-11-24T21:18:01Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ejmath12](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ejmath12/32/82068_2.png) [@ejmath12](https://discuss.elastic.co/u/ejmath12)
#### Post date: [November 24, 2020, 9:18pm UTC](https://discuss.elastic.co/t/divide-two-columns-generated-from-aggregations-in-data-table/256575/1 "2020-11-24T21:18:02Z")

</div>

I am very new to Elastic stack, so apologies upfront, if I am missing the obvious. Let me start by explaining my use case. All documents in my index has field `_idVal`(represents a session). Sessions will have different processes starting and exiting represented by `_processName`. I have another field `_badExit`, which represents a crash. The same process could crash more than once for the same \_idVal. I want to display the cardinality of sessions(`_idVal`), total `_badExit` counts, and sessionsWithCrash(cardinality of sessions with `_badExits`) grouped by \_processName. I am able to use metric aggregation to achieve this. Where I am stuck is while trying to display the ratio of sessionsWithCrash and totalSessions. I tried using Math aggregation in visual builder but it doesn't allow filtering for sub-metric(required for filtering badExit).

```auto

```

---

<div class="post-metadata">

### Author: ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)
#### Post date: [November 24, 2020, 10:18pm UTC](https://discuss.elastic.co/t/divide-two-columns-generated-from-aggregations-in-data-table/256575/2 "2020-11-24T22:18:54Z")

</div>

Hi, welcome to the forums! I think you have two options that make sense to me. TSVB supports a filter ratio function which is able to do this, explained in more detail in [this blog post](https://www.elastic.co/blog/how-to-display-data-as-a-percentage-in-kibana-visualizations). Another pretty common thing is to use the [transforms feature](https://www.elastic.co/guide/en/elasticsearch/reference/current/transforms.html) to let you do a second level of aggregation.

---

<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 22, 2020, 10:19pm UTC](https://discuss.elastic.co/t/divide-two-columns-generated-from-aggregations-in-data-table/256575/3 "2020-12-22T22:19:06Z")

</div>

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