# How to perform calculation for the unique count document in kibana?

**URL:** <https://discuss.elastic.co/t/how-to-perform-calculation-for-the-unique-count-document-in-kibana/185744>\
**Category:** Kibana\
**Created:** [June 14, 2019, 1:50am UTC](https://discuss.elastic.co/t/how-to-perform-calculation-for-the-unique-count-document-in-kibana/185744 "2019-06-14T01:50:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![June](https://avatars.discourse-cdn.com/v4/letter/j/8e7dd6/32.png) [@June](https://discuss.elastic.co/u/June)\
**Post date:** [June 14, 2019, 1:50am UTC](https://discuss.elastic.co/t/how-to-perform-calculation-for-the-unique-count-document-in-kibana/185744/1 "2019-06-14T01:50:05Z")

</div>

Greetings!

Is there any possibility to do the calculation for the unique count document in kibana?

Thanks.

---

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [June 24, 2019, 2:28pm UTC](https://discuss.elastic.co/t/how-to-perform-calculation-for-the-unique-count-document-in-kibana/185744/2 "2019-06-24T14:28:54Z")

</div>

Yes, there's a `unique count` metric aggregation in Kibana visualizations.

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

---

<div class="post-metadata">

**Author:** ![June](https://avatars.discourse-cdn.com/v4/letter/j/8e7dd6/32.png) [@June](https://discuss.elastic.co/u/June)\
**Post date:** [June 26, 2019, 2:35am UTC](https://discuss.elastic.co/t/how-to-perform-calculation-for-the-unique-count-document-in-kibana/185744/3 "2019-06-26T02:35:54Z")

</div>

Hi @LeeDr, thanks for replying.

Kindly advise on the method to achieve the condition as below:

I have a field "test" which consists of 'G','P' and 'N'. I would like to obtain the unique count of timestamp for this field (figure below) then do the calculation: ('G'+'P')/('G'+'P'+'N').  
Is this possible to achieve?  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/b/9b89eef61a1df5981e753a5fd98f0b57cf212f47.png)  
Thank you.

---

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [July 17, 2019, 7:39pm UTC](https://discuss.elastic.co/t/how-to-perform-calculation-for-the-unique-count-document-in-kibana/185744/4 "2019-07-17T19:39:34Z")

</div>

I'm back from vacation. If you haven't solved this yet I can try to help. The only visualization that lets you do calculations like that is the "Visual Builder", also known as Time Series Visual Builder or TSVB for short.

There's a bunch of Discuss posts about visual builder doing ratios of values. Here's the search results;

[https://discuss.elastic.co/search?q=visual%20builder%20ratio%20category%3A7](https://discuss.elastic.co/search?q=visual%20builder%20ratio%20category%3A7)

Please let me know if you need help.

Regards,  
Lee

---

<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:** [August 14, 2019, 7:39pm UTC](https://discuss.elastic.co/t/how-to-perform-calculation-for-the-unique-count-document-in-kibana/185744/5 "2019-08-14T19:39:34Z")

</div>

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