# Distinct count of 2 fields

**URL:** <https://discuss.elastic.co/t/distinct-count-of-2-fields/53278>\
**Category:** Kibana\
**Created:** [June 20, 2016, 7:36am UTC](https://discuss.elastic.co/t/distinct-count-of-2-fields/53278 "2016-06-20T07:36:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![T3rm1](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@T3rm1](https://discuss.elastic.co/u/T3rm1)\
**Post date:** [June 20, 2016, 7:36am UTC](https://discuss.elastic.co/t/distinct-count-of-2-fields/53278/1 "2016-06-20T07:36:49Z")

</div>

My index can have several entries that are equal in two fields. Is it possible to count these as one in the given time interval?  
Example: One field is id, another field is action. The same action can be logged for the same id several times. However I need a chart where this is counted as one.

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [June 20, 2016, 6:31pm UTC](https://discuss.elastic.co/t/distinct-count-of-2-fields/53278/2 "2016-06-20T18:31:53Z")

</div>

Would the "unique count" aggregation accomplish what you're referring to? (When viewing a visualization, under "metrics", instead of selecting "count" as the aggregation, select "unique count".)

---

<div class="post-metadata">

**Author:** ![T3rm1](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@T3rm1](https://discuss.elastic.co/u/T3rm1)\
**Post date:** [June 21, 2016, 7:44am UTC](https://discuss.elastic.co/t/distinct-count-of-2-fields/53278/3 "2016-06-21T07:44:41Z")

</div>

That only works if I want to count unique results of one field but in my case only the combination of two fields is unique.

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [June 21, 2016, 3:47pm UTC](https://discuss.elastic.co/t/distinct-count-of-2-fields/53278/4 "2016-06-21T15:47:09Z")

</div>

Oh, I see. Unfortunately, there isn't any way to accomplish what you're saying in Kibana. You'd have to introduce another field into your mapping which correlates to the combination of those two fields.

---

<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:** [July 6, 2017, 1:49pm UTC](https://discuss.elastic.co/t/distinct-count-of-2-fields/53278/5 "2017-07-06T13:49:44Z")

</div>


