# Add single filter ratio column to data table lens

**URL:** <https://discuss.elastic.co/t/add-single-filter-ratio-column-to-data-table-lens/306895>\
**Category:** Kibana\
**Tags:** lens\
**Created:** [June 10, 2022, 1:16pm UTC](https://discuss.elastic.co/t/add-single-filter-ratio-column-to-data-table-lens/306895 "2022-06-10T13:16:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![redfox](https://avatars.discourse-cdn.com/v4/letter/r/f1d935/32.png) [@redfox](https://discuss.elastic.co/u/redfox)\
**Post date:** [June 10, 2022, 1:16pm UTC](https://discuss.elastic.co/t/add-single-filter-ratio-column-to-data-table-lens/306895/1 "2022-06-10T13:16:47Z")

</div>

Hoping for some help here...  
I have created a lens data table visualisation where I have a number of filters defining the rows in the table and a number of filters summing various criteria for the columns.  
I want to add another column but I want this format to be a % based on a filter criteria / sum of total of another field in that grouping.

I can't seem to be able to do this in latest version of Kibana, and I can't use TSVB because the terms in which I want to group the data by is based on a collection of different values.

e.g.

| | Visited | Purchased | % Purchased |
| --- | --- | --- | --- |
| CustomerGroupX | 10 | 1 | 10.0% |
| CustomerGroupY | 20 | 15 | 75.0% |
| CustomerGroupZ | 50 | 34 | 68.0% |
| ![image | 588x148](upload://e7bBUiMpqb4trDmKLRTg08J0GI9.png) | | |

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [June 13, 2022, 8:15am UTC](https://discuss.elastic.co/t/add-single-filter-ratio-column-to-data-table-lens/306895/2 "2022-06-13T08:15:44Z")

</div>

Lens formula should you allow to do this by using the `overall_sum` function (similar to the "percent of total" example here: [Create visualizations with Lens | Kibana Guide [8.2] | Elastic](https://www.elastic.co/guide/en/kibana/current/lens.html#lens-formulas) )

---

<div class="post-metadata">

**Author:** ![redfox](https://avatars.discourse-cdn.com/v4/letter/r/f1d935/32.png) [@redfox](https://discuss.elastic.co/u/redfox)\
**Post date:** [June 13, 2022, 9:10am UTC](https://discuss.elastic.co/t/add-single-filter-ratio-column-to-data-table-lens/306895/3 "2022-06-13T09:10:51Z")

</div>

Hey...thank you for the reply. Unless I'm missing something glaringly obvious in the configuration of the lens I can't seem to get this to work.  
It seems to add the % calculation to each column in the table. I only want to add it as an individual column.

For example

| What I want | | | | |
| --- | --- | --- | --- | --- |
| | Visited | Purchased | Converted | |
| CustomerGroupX | 10 | 1 | 10.0% | |
| CustomerGroupY | 20 | 15 | 75.0% | |
| CustomerGroupZ | 50 | 34 | 68.0% | |
| | | | | |
| What I get | | | | |
| | Visited | | Purchased | Converted |
| CustomerGroupX | 10 | x.xx% | 1 | y.y% |
| CustomerGroupY | 20 | x.x% | 15 | y.y% |
| CustomerGroupZ | 50 | x.x% | 34 | y.y% |

---

<div class="post-metadata">

**Author:** ![ghudgins](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ghudgins/32/138532_2.png) [@ghudgins](https://discuss.elastic.co/u/ghudgins)\
**Post date:** [June 13, 2022, 4:02pm UTC](https://discuss.elastic.co/t/add-single-filter-ratio-column-to-data-table-lens/306895/4 "2022-06-13T16:02:18Z")

</div>

I'm guessing at your configuration but try removing the "Columns" configuration entirely (this is like a pivot table so it'll repeat the metrics for each pivot which it sounds like you don't want)....then, name each metric "Visited" "Purchased" "Converted" - you can write a filter for each metric under advanced options if you need it.

---

<div class="post-metadata">

**Author:** ![redfox](https://avatars.discourse-cdn.com/v4/letter/r/f1d935/32.png) [@redfox](https://discuss.elastic.co/u/redfox)\
**Post date:** [June 14, 2022, 9:16am UTC](https://discuss.elastic.co/t/add-single-filter-ratio-column-to-data-table-lens/306895/5 "2022-06-14T09:16:07Z")

</div>

I owe you a pint! This has worked a treat! Thank you a thousand times

---

<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:** [July 12, 2022, 9:16am UTC](https://discuss.elastic.co/t/add-single-filter-ratio-column-to-data-table-lens/306895/6 "2022-07-12T09:16:31Z")

</div>

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