# Is it possible to add a runtime field which is the percentage of two different columns in the same row?

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-add-a-runtime-field-which-is-the-percentage-of-two-different-columns-in-the-same-row/285597>\
**Category:** Kibana\
**Tags:** runtime-fields\
**Created:** [September 30, 2021, 1:39pm UTC](https://discuss.elastic.co/t/is-it-possible-to-add-a-runtime-field-which-is-the-percentage-of-two-different-columns-in-the-same-row/285597 "2021-09-30T13:39:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amphagory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amphagory/32/46127_2.png) [@Amphagory](https://discuss.elastic.co/u/Amphagory)\
**Post date:** [September 30, 2021, 1:39pm UTC](https://discuss.elastic.co/t/is-it-possible-to-add-a-runtime-field-which-is-the-percentage-of-two-different-columns-in-the-same-row/285597/1 "2021-09-30T13:39:51Z")

</div>

Hello,

I see scripted fields has been deprecated in 7.13 and it is suggested that we use runtime fields.

I was wondering if it is possible to add a runtime field which calculates the ratio of two different column values in the same row?

The following is a simple example:

I can generate a table which has the rows separated by Call Center name and two columns which are the sum of Incoming calls and sum of Outgoing Calls.

The next two columns are the ones I would like to generate:

- % Incoming Calls = sum Incoming calls / (sum Incoming calls + sum of Outgoing Calls)

- % Outgoing Calls = sum of Outgoing Calls / (sum of Incoming calls + sum of Outgoing Calls)

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

Thanks in advance for your help!

Mike

---

<div class="post-metadata">

**Author:** ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)\
**Post date:** [September 30, 2021, 2:01pm UTC](https://discuss.elastic.co/t/is-it-possible-to-add-a-runtime-field-which-is-the-percentage-of-two-different-columns-in-the-same-row/285597/2 "2021-09-30T14:01:46Z")

</div>

Hi @Amphagory ,

I think you can achieve that using Lens new Formula's feature.  
As a basic rule of thumb, `runtime fields` are pretty good at enriching fields data while Lens Formula is best to to math calculations with aggregations.

---

<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:** [October 28, 2021, 2:01pm UTC](https://discuss.elastic.co/t/is-it-possible-to-add-a-runtime-field-which-is-the-percentage-of-two-different-columns-in-the-same-row/285597/3 "2021-10-28T14:01:51Z")

</div>

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