# Lens: Top values bar diagram with percentage

**URL:** <https://discuss.elastic.co/t/lens-top-values-bar-diagram-with-percentage/303591>\
**Category:** Kibana\
**Tags:** lens\
**Created:** [April 29, 2022, 10:15am UTC](https://discuss.elastic.co/t/lens-top-values-bar-diagram-with-percentage/303591 "2022-04-29T10:15:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomhe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomhe/32/120065_2.png) [@tomhe](https://discuss.elastic.co/u/tomhe)\
**Post date:** [April 29, 2022, 10:15am UTC](https://discuss.elastic.co/t/lens-top-values-bar-diagram-with-percentage/303591/1 "2022-04-29T10:15:05Z")

</div>

I would like to be able to see percentages for each bar in a bar graph for top values, just like a donut chart displays it. Is this planned to be added in the future or is the donut chart my only option if I want percentages for top values?

(I'm running 8.1.2.)

This is illustrated by the picture below where I first created a bar chart, then cloned the panel and changed to donut. Same underlying data, but I can only get percentages for the donut type.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/0/70496d383cfbde53835f2437b0fa08712022c201.png)

Visual options for bar chart:

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

Donut charts have labels options instead (where I can ask for values as percentages):

![image](https://us1.discourse-cdn.com/elastic/original/3X/f/b/fbcd5d320183e3d52fb9dd1cb0a682f3f8df990f.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:** [April 29, 2022, 3:29pm UTC](https://discuss.elastic.co/t/lens-top-values-bar-diagram-with-percentage/303591/2 "2022-04-29T15:29:15Z")

</div>

If you only care about percentage, you can use the Lens formula to do the calculation (there is a downside to this though - you won't be able to rank by the formula):

 ![Screenshot 2022-04-29 at 17.28.12](https://us1.discourse-cdn.com/elastic/original/3X/2/3/23b9dec5c91e8318dc4fc100b1256648fc416d7c.png)

---

<div class="post-metadata">

**Author:** ![tomhe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomhe/32/120065_2.png) [@tomhe](https://discuss.elastic.co/u/tomhe)\
**Post date:** [April 29, 2022, 5:37pm UTC](https://discuss.elastic.co/t/lens-top-values-bar-diagram-with-percentage/303591/3 "2022-04-29T17:37:00Z")

</div>

Thank you. I did not think to use the overall\_sum() function this way.

Ideally I would like to be able to see both count and percentage in the tooltip when I hover over a bar, but this is still a way forward for me.

---

<div class="post-metadata">

**Author:** ![tomhe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomhe/32/120065_2.png) [@tomhe](https://discuss.elastic.co/u/tomhe)\
**Post date:** [May 2, 2022, 5:46am UTC](https://discuss.elastic.co/t/lens-top-values-bar-diagram-with-percentage/303591/4 "2022-05-02T05:46:26Z")

</div>

I just realized that not being able to rank is a bigger drawback than I first thought: I have quite a few visualizations where I have more values than number of bars (where I group them in an "Other" bucket). Without ranking support, any value might end up in the "Other" bucket, not just the smallest buckets. So I'm back with showing counts or switching to pie/donut charts.

I don't really see why bar visualizations can't have the same features as pie/donut visualizations. After all, it's exactly the same data where the sizes of the bars directly correspond to the sizes of the slices.

In general, it would be nice to have the option of showing percentages everywhere, e.g. in the tooltip on a line chart with multiple lines. I believe that presenting both count and percentage would add much value.

Do you know if this is in the roadmap?

---

<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:** [May 2, 2022, 4:00pm UTC](https://discuss.elastic.co/t/lens-top-values-bar-diagram-with-percentage/303591/5 "2022-05-02T16:00:28Z")

</div>

we do have tooltip customization on the horizon. currently working on a redesigned system in elastic-charts.

once we have that we'll bring more options like additional metrics that you mention [[Lens] Allow extra metrics in the tooltip · Issue #106024 · elastic/kibana · GitHub](https://github.com/elastic/kibana/issues/106024)

on the bar chart showing % as an option without using formula and retaining the rank by--there is a longer term plan to bring this sort of rank by formula to Kibana more broadly but I do wonder if we should enable something quickly / visually for % on bars like we calculate for pies. I've made an issue in Kibana to continue the discussion [[Lens] display counts, sum, last values as a percentage on XY visualizations · Issue #131340 · elastic/kibana · GitHub](https://github.com/elastic/kibana/issues/131340)

---

<div class="post-metadata">

**Author:** ![tomhe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomhe/32/120065_2.png) [@tomhe](https://discuss.elastic.co/u/tomhe)\
**Post date:** [May 2, 2022, 5:09pm UTC](https://discuss.elastic.co/t/lens-top-values-bar-diagram-with-percentage/303591/6 "2022-05-02T17:09:35Z")

</div>

Thank you. #131340 is exactly what I’m looking for.

---

<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 30, 2022, 5:09pm UTC](https://discuss.elastic.co/t/lens-top-values-bar-diagram-with-percentage/303591/7 "2022-05-30T17:09:40Z")

</div>

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