# How i can show percentage on gauge chart

**URL:** https://discuss.elastic.co/t/how-i-can-show-percentage-on-gauge-chart/306090
**Category:** Kibana
**Created:** [June 1, 2022, 8:21am UTC](https://discuss.elastic.co/t/how-i-can-show-percentage-on-gauge-chart/306090 "2022-06-01T08:21:49Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![akshay\_bhardwaj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akshay_bhardwaj/32/106428_2.png) [@akshay\_bhardwaj](https://discuss.elastic.co/u/akshay_bhardwaj)
#### Post date: [June 1, 2022, 8:21am UTC](https://discuss.elastic.co/t/how-i-can-show-percentage-on-gauge-chart/306090/1 "2022-06-01T08:21:49Z")

</div>

I have a column in data which contain 1000 row and values are 0 and 1 , how i can calculate percentage and show on gauge. for example 750 rows have 1 than percentage is 75

---

<div class="post-metadata">

### Author: ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)
#### Post date: [June 1, 2022, 8:25am UTC](https://discuss.elastic.co/t/how-i-can-show-percentage-on-gauge-chart/306090/2 "2022-06-01T08:25:29Z")

</div>

Hi @akshay_bhardwaj ,

I think you can use Lens formula for this use case:

```auto
sum(my_field) / count()

```

and set the data format to percentage.

---

<div class="post-metadata">

### Author: ![akshay\_bhardwaj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akshay_bhardwaj/32/106428_2.png) [@akshay\_bhardwaj](https://discuss.elastic.co/u/akshay_bhardwaj)
#### Post date: [June 1, 2022, 9:07am UTC](https://discuss.elastic.co/t/how-i-can-show-percentage-on-gauge-chart/306090/3 "2022-06-01T09:07:05Z")

</div>

> [@Marco\_Liberati](#):
>
> `sum(my_field) / count()`

but there is no percentile aggregation method in gauge.  
can we do it with advance json input?

 ![Screenshot from 2022-06-01 14-35-24](https://us1.discourse-cdn.com/elastic/original/3X/1/c/1c7d921c9bc05c05896c6054cf9b6930a1046cde.png)

---

<div class="post-metadata">

### Author: ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)
#### Post date: [June 1, 2022, 9:11am UTC](https://discuss.elastic.co/t/how-i-can-show-percentage-on-gauge-chart/306090/4 "2022-06-01T09:11:40Z")

</div>

What version of the stack are you using?  
The one you've opened is the Aggregation based editor, while formula is available in the Lens editor.

---

<div class="post-metadata">

### Author: ![akshay\_bhardwaj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akshay_bhardwaj/32/106428_2.png) [@akshay\_bhardwaj](https://discuss.elastic.co/u/akshay_bhardwaj)
#### Post date: [June 1, 2022, 9:26am UTC](https://discuss.elastic.co/t/how-i-can-show-percentage-on-gauge-chart/306090/5 "2022-06-01T09:26:14Z")

</div>

But in lens editor above gauge(circle) is not present.

 ![Screenshot from 2022-06-01 14-55-50](https://us1.discourse-cdn.com/elastic/original/3X/6/a/6a9fcd38072062b2019851ec7d8a9ce21c3ce900.png)

---

<div class="post-metadata">

### Author: ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)
#### Post date: [June 1, 2022, 9:44am UTC](https://discuss.elastic.co/t/how-i-can-show-percentage-on-gauge-chart/306090/6 "2022-06-01T09:44:14Z")

</div>

You are correct, there are no half circle gauges in Lens, only vertical and horizontal ones.

If you really need semi-circle gauges, the only solution I can think of it TSVB:

- Select the Gauge visualization
- Configure a `Count` aggregation, then add a new aggregation
- Configure a `Sum` aggregation, then add a new aggregation
- Configure a `Math` aggregation, then configure two variables: `count` for the `Count` metric, and `sum_metric` for the `Sum` metric
  - Type `params.sum_metric / count` in the Math text field.

- In the `Options` panel ( on top of the panel, next to `Metrics`) pick the `Percentage formatter`

---

<div class="post-metadata">

### Author: ![akshay\_bhardwaj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akshay_bhardwaj/32/106428_2.png) [@akshay\_bhardwaj](https://discuss.elastic.co/u/akshay_bhardwaj)
#### Post date: [June 1, 2022, 10:19am UTC](https://discuss.elastic.co/t/how-i-can-show-percentage-on-gauge-chart/306090/7 "2022-06-01T10:19:29Z")

</div>

> [@Marco\_Liberati](#):
>
> `params.sum_metric / count`

Thanks Marco can you please me more to add percentage sign % after value and round up decimal values

---

<div class="post-metadata">

### Author: ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)
#### Post date: [June 1, 2022, 10:21am UTC](https://discuss.elastic.co/t/how-i-can-show-percentage-on-gauge-chart/306090/8 "2022-06-01T10:21:42Z")

</div>

As described in the last step above, if you choose the `Percent` formatter will add the `%` on its own.

 ![Screenshot 2022-06-01 at 12.21.03](https://us1.discourse-cdn.com/elastic/original/3X/4/7/47ca8f7b628e1c151909f57560651653aacc776f.png)

---

<div class="post-metadata">

### Author: ![akshay\_bhardwaj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akshay_bhardwaj/32/106428_2.png) [@akshay\_bhardwaj](https://discuss.elastic.co/u/akshay_bhardwaj)
#### Post date: [June 1, 2022, 10:27am UTC](https://discuss.elastic.co/t/how-i-can-show-percentage-on-gauge-chart/306090/9 "2022-06-01T10:27:46Z")

</div>

Thanks Marco for you quick response.....

---

<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: [June 29, 2022, 10:28am UTC](https://discuss.elastic.co/t/how-i-can-show-percentage-on-gauge-chart/306090/10 "2022-06-29T10:28:32Z")

</div>

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