# Elastic metric count to percentage

**URL:** <https://discuss.elastic.co/t/elastic-metric-count-to-percentage/330806>\
**Category:** Kibana\
**Tags:** kql-kibana-query-language\
**Created:** [April 26, 2023, 8:48am UTC](https://discuss.elastic.co/t/elastic-metric-count-to-percentage/330806 "2023-04-26T08:48:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prathamesh\_S\_Pai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prathamesh_s_pai/32/120231_2.png) [@Prathamesh\_S\_Pai](https://discuss.elastic.co/u/Prathamesh_S_Pai)\
**Post date:** [April 26, 2023, 8:48am UTC](https://discuss.elastic.co/t/elastic-metric-count-to-percentage/330806/1 "2023-04-26T08:48:05Z")

</div>

I am using metric visualization type in kibana. In Metric section, I have used 'count' aggregation and in bucket section, i have used 'terms' aggregation with field 'executionStatus.keyword' and clicked on 'update' button. The output shows '154 Executed-Count' and '4 Not Executed-Count'.

How to show this in percentage? I want the output to be '97.47% Executed-Count' and 2.53% Not Executed-Count'

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [April 26, 2023, 6:27pm UTC](https://discuss.elastic.co/t/elastic-metric-count-to-percentage/330806/2 "2023-04-26T18:27:47Z")

</div>

Hi @Prathamesh_S_Pai. I think you could use a custom formula in Lens to calculate the percentages. For example, `count() / overall_sum(count())`. You'll also want to change the "Value format" to "Percent".

 ![localhost_5601_jgt_app_lens](https://us1.discourse-cdn.com/elastic/original/3X/2/9/298031ca3b2d22cf0ef87a12db6c784a2e6cc947.jpeg)

---

<div class="post-metadata">

**Author:** ![Prathamesh\_S\_Pai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prathamesh_s_pai/32/120231_2.png) [@Prathamesh\_S\_Pai](https://discuss.elastic.co/u/Prathamesh_S_Pai)\
**Post date:** [April 27, 2023, 4:53am UTC](https://discuss.elastic.co/t/elastic-metric-count-to-percentage/330806/3 "2023-04-27T04:53:35Z")

</div>

Hi @nickpeihl,  
Thank you for your response.  
Since I am using metric visualization type, I not seeing any formula tab either in Data or in Options section.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/2/6278627aae114af450551686b7097eb641695003.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/f/ff9cb1a0628029efd23e516d0249bb1c4379b093.png)

Could you please let me know how to convert those count to percentage?

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [April 27, 2023, 5:01pm UTC](https://discuss.elastic.co/t/elastic-metric-count-to-percentage/330806/4 "2023-04-27T17:01:04Z")

</div>

Hi @Prathamesh_S_Pai. Which version of Kibana are you using? The formula editor is only available in our Lens visualization editor. Your screenshots are showing an older, legacy visualization editor which does not support formulas.

---

<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 25, 2023, 5:01pm UTC](https://discuss.elastic.co/t/elastic-metric-count-to-percentage/330806/5 "2023-05-25T17:01:23Z")

</div>

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