# How to perform calculations in KIbana 6.5?

**URL:** <https://discuss.elastic.co/t/how-to-perform-calculations-in-kibana-6-5/175432>\
**Category:** Kibana\
**Created:** [April 4, 2019, 2:04pm UTC](https://discuss.elastic.co/t/how-to-perform-calculations-in-kibana-6-5/175432 "2019-04-04T14:04:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sonam\_Verma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sonam_verma/32/43505_2.png) [@Sonam\_Verma](https://discuss.elastic.co/u/Sonam_Verma)\
**Post date:** [April 4, 2019, 2:04pm UTC](https://discuss.elastic.co/t/how-to-perform-calculations-in-kibana-6-5/175432/1 "2019-04-04T14:04:53Z")

</div>

I want to calculate the following:  
Vol(%) - (Total Volunary attrition till the month/avg HC)\*(365/No. of days in the year so far)

I am new to kibana and want to know the ways to calculate above.  
The fields on the right hand side also needs to be calculated.

Thanks in Advance!

---

<div class="post-metadata">

**Author:** ![mattkime](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattkime/32/43522_2.png) [@mattkime](https://discuss.elastic.co/u/mattkime)\
**Post date:** [April 4, 2019, 5:53pm UTC](https://discuss.elastic.co/t/how-to-perform-calculations-in-kibana-6-5/175432/2 "2019-04-04T17:53:51Z")

</div>

Hello [Sonam\_Verma](https://discuss.elastic.co/u/Sonam_Verma)

Have you considered using a scripted field? [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-script-fields.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-script-fields.html)

---

<div class="post-metadata">

**Author:** ![Sonam\_Verma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sonam_verma/32/43505_2.png) [@Sonam\_Verma](https://discuss.elastic.co/u/Sonam_Verma)\
**Post date:** [April 5, 2019, 4:58am UTC](https://discuss.elastic.co/t/how-to-perform-calculations-in-kibana-6-5/175432/3 "2019-04-05T04:58:53Z")

</div>

Yes.. I did after going through painless scripted fields. But complexity increases as scripted fields consider single document.

---

<div class="post-metadata">

**Author:** ![mattkime](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattkime/32/43522_2.png) [@mattkime](https://discuss.elastic.co/u/mattkime)\
**Post date:** [April 9, 2019, 4:18pm UTC](https://discuss.elastic.co/t/how-to-perform-calculations-in-kibana-6-5/175432/4 "2019-04-09T16:18:58Z")

</div>

Which Kibana feature are you using? Maybe there's a feature specific way to solve this.

> But complexity increases as scripted fields consider single document.

Could you say more about the problems you're having with calculated fields?

---

<div class="post-metadata">

**Author:** ![Sonam\_Verma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sonam_verma/32/43505_2.png) [@Sonam\_Verma](https://discuss.elastic.co/u/Sonam_Verma)\
**Post date:** [April 10, 2019, 6:40am UTC](https://discuss.elastic.co/t/how-to-perform-calculations-in-kibana-6-5/175432/5 "2019-04-10T06:40:49Z")

</div>

I am using Kibana 6.7 Visual builder feature. I want to calculate percentage of Voluntary Attrition of a company- so for this, I have 2 CSV files. One is having data of active employees and other is having data of Attrition.

Now, I pushed merged data from both sheets to ES using logstash. Therefore, finally I have an index which is having merged data of active employees and attrition.

My calculation requires to calculate following-

1. Total count of Voluntary Attrition
2. Average Headcount of company

Now, after calculating them, I need to show the result on visualization. But the problem is, that they need to be calculated as different series in Metric visual builder, then only they are generating desired results. So, Can you help me with this?

 ![Image2](https://us1.discourse-cdn.com/elastic/original/3X/d/3/d373f8fc2f627d0ed1db8a1afaaa5e2e70013263.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/9/89a31d5e590049f992ecb2ab0de89dd1bda7b6ec.png)

---

<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 8, 2019, 6:41am UTC](https://discuss.elastic.co/t/how-to-perform-calculations-in-kibana-6-5/175432/6 "2019-05-08T06:41:00Z")

</div>

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