# Count fields with the same value as one

**URL:** <https://discuss.elastic.co/t/count-fields-with-the-same-value-as-one/260466>\
**Category:** Kibana\
**Created:** [January 7, 2021, 4:15pm UTC](https://discuss.elastic.co/t/count-fields-with-the-same-value-as-one/260466 "2021-01-07T16:15:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Angelos](https://avatars.discourse-cdn.com/v4/letter/a/4bbf92/32.png) [@Angelos](https://discuss.elastic.co/u/Angelos)\
**Post date:** [January 7, 2021, 4:15pm UTC](https://discuss.elastic.co/t/count-fields-with-the-same-value-as-one/260466/1 "2021-01-07T16:15:38Z")

</div>

Hi!

I have many fields which have the same value.

So let's we have those document in different time periods:

```auto
@timestamp	Jan 6, 2021 @ 23:00:00
field.mess value1
field.sub	examp1

```

```auto
@timestamp	Jan 6, 2021 @ 23:00:01
field.mess value1
field.sub	examp1

```

```auto
@timestamp	Jan 6, 2021 @ 23:00:02
field.mess value2
field.sub	examp1

```

Is there any way to count the **value1** as one in Kibana?  
So that the result in a graph should show that we have two **field.mess** (value1 and value2) not three.

Thank you in advance!

/Angelos

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [January 7, 2021, 7:31pm UTC](https://discuss.elastic.co/t/count-fields-with-the-same-value-as-one/260466/2 "2021-01-07T19:31:29Z")

</div>

Yes, you can get an approximate count using the Cardinality/Unique Count aggregation. It is exact for small values, approximate for larger values: [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-cardinality-aggregation.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-cardinality-aggregation.html)

---

<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:** [February 4, 2021, 7:31pm UTC](https://discuss.elastic.co/t/count-fields-with-the-same-value-as-one/260466/3 "2021-02-04T19:31:43Z")

</div>

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