# Unique Count of a Count

**URL:** <https://discuss.elastic.co/t/unique-count-of-a-count/321612>\
**Category:** Kibana\
**Created:** [December 20, 2022, 6:24am UTC](https://discuss.elastic.co/t/unique-count-of-a-count/321612 "2022-12-20T06:24:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![QuestBevan](https://avatars.discourse-cdn.com/v4/letter/q/858c86/32.png) [@QuestBevan](https://discuss.elastic.co/u/QuestBevan)\
**Post date:** [December 20, 2022, 6:24am UTC](https://discuss.elastic.co/t/unique-count-of-a-count/321612/1 "2022-12-20T06:24:11Z")

</div>

Hi All,

I am trying to figure out a way to build this visualisation.

Our use case is, we have X amount of devices\_serial\_numbers (string field) that we want to monitor. Each device send up a result (string field) on whether is passes or fails a test.

The test can be completed multiple times and a new event/document is generated every time the test is completed.

I want to represent "How many "devices\_serial\_numbers" have a count of X number of "result=failed"". So if within the timeframe there is

- 5 failed test for serial number 1234
- 4 failed test for serial number 2345
- 4 failed test for serial number 3456
- 2 failed tests for serial number 4321

I would see 3 bars, in a bar-chart.  
1st bar would be a value of 1, as the unique count is 1.  
2nd bar would be a value of 2, as there are 2 serial numbers where the count if 4.  
3rd bar would be a value of 1, as the unique count is 1.

---

<div class="post-metadata">

**Author:** ![Stratoula\_Kalafateli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stratoula_kalafateli/32/70923_2.png) [@Stratoula\_Kalafateli](https://discuss.elastic.co/u/Stratoula_Kalafateli)\
**Post date:** [December 20, 2022, 7:45am UTC](https://discuss.elastic.co/t/unique-count-of-a-count/321612/2 "2022-12-20T07:45:25Z")

</div>

Hey! If I understand correctly what you want to do, you could so something like that (this is a Lens example)

Add on a horizontal bar the top values of the serial number (vertical axis) and then the unique count of result and use a filter result: failed

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/d/1de7dce3f4334190e4c1ea0f6d0aeb7952a20a8a.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/d/0db51e967b1bda0dedf2d17154d599834fad0b59.png)

---

<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 17, 2023, 7:46am UTC](https://discuss.elastic.co/t/unique-count-of-a-count/321612/3 "2023-01-17T07:46:14Z")

</div>

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