# How to get count in percentage in data table of kibana

**URL:** <https://discuss.elastic.co/t/how-to-get-count-in-percentage-in-data-table-of-kibana/137000>\
**Category:** Kibana\
**Created:** [June 22, 2018, 9:24am UTC](https://discuss.elastic.co/t/how-to-get-count-in-percentage-in-data-table-of-kibana/137000 "2018-06-22T09:24:37Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![christophilus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christophilus/32/42991_2.png) [@christophilus](https://discuss.elastic.co/u/christophilus)\
**Post date:** [July 9, 2018, 2:04pm UTC](https://discuss.elastic.co/t/how-to-get-count-in-percentage-in-data-table-of-kibana/137000/2 "2018-07-09T14:04:44Z")

</div>

So, you need to ask yourself a few questions:

- How is a unique user identified? Is it just the serialNo? Is it a combination of fields?

If it's a single field, you can count unique values fairly simply if it's a combination of fields, you'll need to do a scripted query as described here:

> **[Terms aggregation | Elasticsearch Guide \[8.11\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#search-aggregations-bucket-terms-aggregation-script)**

Once you have a query that gives you a count of the distinct values, you can display an aggregate. Here's a question and answer about how to display a percentage.

> [@Gauge with dynamic maximum value](https://discuss.elastic.co/t/gauge-with-dynamic-maximum-value/130634/2):
>
> Hi Michael, You should be able to do this using the Time Series Visual Builder. If you choose "gauge", then "panel options", you can specify "1" as your max value. Then in your gauge data settings, you can compute the dynamic ratio per table. Here's a screenshot of a similar setup: Hope that helps!

One last note: it may be easier to massage your data so that it's stored in a way that makes the Kibana queries easier to write and reason about.

---

_[View the full topic](https://discuss.elastic.co/t/how-to-get-count-in-percentage-in-data-table-of-kibana/137000)._
