# Kibana - calculation in table

**URL:** <https://discuss.elastic.co/t/kibana-calculation-in-table/174597>\
**Category:** Kibana\
**Created:** [March 29, 2019, 6:38pm UTC](https://discuss.elastic.co/t/kibana-calculation-in-table/174597 "2019-03-29T18:38:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francisca\_Lima](https://avatars.discourse-cdn.com/v4/letter/f/edb3f5/32.png) [@Francisca\_Lima](https://discuss.elastic.co/u/Francisca_Lima)\
**Post date:** [March 29, 2019, 6:38pm UTC](https://discuss.elastic.co/t/kibana-calculation-in-table/174597/1 "2019-03-29T18:38:46Z")

</div>

Hello,  
There is a way to do calculations with the results presented in table visualizations? Not with scripted field, but with the values that are displayed in the table.

Thank you,  
Francisca

---

<div class="post-metadata">

**Author:** ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)\
**Post date:** [March 29, 2019, 11:19pm UTC](https://discuss.elastic.co/t/kibana-calculation-in-table/174597/2 "2019-03-29T23:19:30Z")

</div>

Hi, there are many aggregations in Elasticsearch, many of them can group data up by something calculated. Almost everything in Kibana will use an Elasticsearch query feature to calculate something based on your documents.

Can you help us understand what you're trying to do? What kind of data, what are you trying to get the table to look like?

---

<div class="post-metadata">

**Author:** ![Francisca\_Lima](https://avatars.discourse-cdn.com/v4/letter/f/edb3f5/32.png) [@Francisca\_Lima](https://discuss.elastic.co/u/Francisca_Lima)\
**Post date:** [April 1, 2019, 8:52am UTC](https://discuss.elastic.co/t/kibana-calculation-in-table/174597/3 "2019-04-01T08:52:03Z")

</div>

Hello,  
Here it is the example that I want to make:

 ![Inkedabc_LI](https://us1.discourse-cdn.com/elastic/original/3X/a/4/a4448c9e1efafc0e75d0692af5e7d00a793b0740.jpeg)  
I want to calculate the x1/x2 of the values presented in the table and not the values line by line, because the results will be different. If I calculate line by line, I will need to do here a average of those values, which will result in different calculated values. Is there a way to do it?

Thank you,  
Francisca

---

<div class="post-metadata">

**Author:** ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)\
**Post date:** [April 1, 2019, 5:41pm UTC](https://discuss.elastic.co/t/kibana-calculation-in-table/174597/4 "2019-04-01T17:41:30Z")

</div>

It might work to try this in Canvas. I'm not sure how you would get your data as those first 2 columns in Canvas. Maybe ES-SQL would work, or if you want to try your hand at programming, you could make a custom Canvas function that calls ES to run the "unique count per year" aggregation, and return the data table.

Then you can use [mapColumn](https://www.elastic.co/guide/en/kibana/current/canvas-common-functions.html#_mapcolumn) to get the calculated results

See:

- [https://www.elastic.co/blog/getting-started-with-canvas-in-kibana](https://www.elastic.co/blog/getting-started-with-canvas-in-kibana)
- [https://www.elastic.co/guide/en/kibana/current/canvas.html](https://www.elastic.co/guide/en/kibana/current/canvas.html)

---

<div class="post-metadata">

**Author:** ![Francisca\_Lima](https://avatars.discourse-cdn.com/v4/letter/f/edb3f5/32.png) [@Francisca\_Lima](https://discuss.elastic.co/u/Francisca_Lima)\
**Post date:** [April 3, 2019, 2:37pm UTC](https://discuss.elastic.co/t/kibana-calculation-in-table/174597/5 "2019-04-03T14:37:15Z")

</div>

Thank you, but I want to add to a dashboard, with Canvas that is not possible. Any other solution? I tried to use the Advanced \> JSON Input, however this options it is not very flexible to add queries to data, to calculate the desired metrics.

---

<div class="post-metadata">

**Author:** ![whoami](https://avatars.discourse-cdn.com/v4/letter/w/a9a28c/32.png) [@whoami](https://discuss.elastic.co/u/whoami)\
**Post date:** [April 4, 2019, 1:48am UTC](https://discuss.elastic.co/t/kibana-calculation-in-table/174597/6 "2019-04-04T01:48:14Z")

</div>

> **[fbaligand/kibana-enhanced-table](https://github.com/fbaligand/kibana-enhanced-table)**
>
> Kibana visualization like a Data Table, but with enhanced features like computed columns and filter bar - fbaligand/kibana-enhanced-table

---

<div class="post-metadata">

**Author:** ![Francisca\_Lima](https://avatars.discourse-cdn.com/v4/letter/f/edb3f5/32.png) [@Francisca\_Lima](https://discuss.elastic.co/u/Francisca_Lima)\
**Post date:** [April 8, 2019, 2:22pm UTC](https://discuss.elastic.co/t/kibana-calculation-in-table/174597/7 "2019-04-08T14:22:58Z")

</div>

Thank you! I will try!

---

<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:** [May 6, 2019, 2:22pm UTC](https://discuss.elastic.co/t/kibana-calculation-in-table/174597/8 "2019-05-06T14:22:59Z")

</div>

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