# How to show Y axis in percentage instead of count in vertical bar chart

**URL:** <https://discuss.elastic.co/t/how-to-show-y-axis-in-percentage-instead-of-count-in-vertical-bar-chart/289778>\
**Category:** Kibana\
**Created:** [November 22, 2021, 7:57am UTC](https://discuss.elastic.co/t/how-to-show-y-axis-in-percentage-instead-of-count-in-vertical-bar-chart/289778 "2021-11-22T07:57:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Divyank\_Mahalle](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divyank_mahalle/32/91240_2.png) [@Divyank\_Mahalle](https://discuss.elastic.co/u/Divyank_Mahalle)\
**Post date:** [November 22, 2021, 7:57am UTC](https://discuss.elastic.co/t/how-to-show-y-axis-in-percentage-instead-of-count-in-vertical-bar-chart/289778/1 "2021-11-22T07:57:40Z")

</div>

Hi,

I am using a vertical bar chart for data visualization. I want percentage instead of count in Y-axis.  
I checked multiple options but was unable to get through it,

Viz Pic-

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/c/ecb6460cf41a04b6001e66572bb72805a64b71d7.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:** [November 22, 2021, 8:01am UTC](https://discuss.elastic.co/t/how-to-show-y-axis-in-percentage-instead-of-count-in-vertical-bar-chart/289778/2 "2021-11-22T08:01:13Z")

</div>

What exactly do you mean by percentage here? If it's the percentage of each bar of the total of all bars, then Lens formula is probably the right tool. See [Create visualizations with Lens | Kibana Guide [7.15] | Elastic](https://www.elastic.co/guide/en/kibana/current/lens.html#lens-formulas) under "Percent of total example"

---

<div class="post-metadata">

**Author:** ![Divyank\_Mahalle](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divyank_mahalle/32/91240_2.png) [@Divyank\_Mahalle](https://discuss.elastic.co/u/Divyank_Mahalle)\
**Post date:** [November 25, 2021, 11:07am UTC](https://discuss.elastic.co/t/how-to-show-y-axis-in-percentage-instead-of-count-in-vertical-bar-chart/289778/3 "2021-11-25T11:07:40Z")

</div>

HI @flash1293 ,  
Thanks for the reply.

> What exactly do you mean by percentage here?  
> I need to get the percentage of delivered messages out of total messages for each bar on Y axis and the count of total messages on each bar.

Snap-

![image](https://us1.discourse-cdn.com/elastic/original/3X/f/6/f61718e9639ae089f88fe5415b04f5d6ccec383f.jpeg)

---

<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:** [November 30, 2021, 9:54am UTC](https://discuss.elastic.co/t/how-to-show-y-axis-in-percentage-instead-of-count-in-vertical-bar-chart/289778/4 "2021-11-30T09:54:50Z")

</div>

It seems like the link I posted above should help with this - Lens formula is flexible in the types of calculations in can perform.

---

<div class="post-metadata">

**Author:** ![Divyank\_Mahalle](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divyank_mahalle/32/91240_2.png) [@Divyank\_Mahalle](https://discuss.elastic.co/u/Divyank_Mahalle)\
**Post date:** [December 7, 2021, 2:24pm UTC](https://discuss.elastic.co/t/how-to-show-y-axis-in-percentage-instead-of-count-in-vertical-bar-chart/289778/5 "2021-12-07T14:24:27Z")

</div>

HI @flash1293 ,

Yes, the Vertical axis is in percentage now using "vertical bar chart percentage" in the lens.

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

Some things are pending though.

1. Actually, I want to show only one status which is "Delivered" in bar chart as shown in earlier reply, while I am doing it, all other bars show "100%".

Snap-

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/2/82b1a6eaea10a7a3c65a5233507ed916b1ae2bdf.png)

1. Legends need to be on the downside.

2. Total count of docs should be visible in each bar.

I tried applying the above 3 but it's not working/getting implemented.

Pls, let me know if that's possible.  
(Apologies if I sound too demanding)

---

<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:** [December 7, 2021, 5:15pm UTC](https://discuss.elastic.co/t/how-to-show-y-axis-in-percentage-instead-of-count-in-vertical-bar-chart/289778/6 "2021-12-07T17:15:43Z")

</div>

> Actually, I want to show only one status which is "Delivered" in bar chart as shown in earlier reply, while I am doing it, all other bars show "100%".

It sounds like you want to use a regular bar chart (not percentage and not stacked), then using a formula for the metric like this: `count(kql="STAT.keyword:DELIVERED")/count()` (or however the status field is called) and picking percentage as a format

> 1. Legends need to be on the downside.

The second icon in the toolbar (the one next to the brush) allows you to customize that

> 1. Total count of docs should be visible in each bar.

If you are switching to the regular vertical bar chart the first icon in the toolbar (the brush icon one) allows you to show the values on the bar

---

<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:** [January 4, 2022, 5:16pm UTC](https://discuss.elastic.co/t/how-to-show-y-axis-in-percentage-instead-of-count-in-vertical-bar-chart/289778/7 "2022-01-04T17:16:42Z")

</div>

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