# Creating a unique count histogram

**URL:** https://discuss.elastic.co/t/creating-a-unique-count-histogram/141269
**Category:** Kibana
**Created:** [July 24, 2018, 1:02am UTC](https://discuss.elastic.co/t/creating-a-unique-count-histogram/141269 "2018-07-24T01:02:09Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![samh](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@samh](https://discuss.elastic.co/u/samh)
#### Post date: [July 24, 2018, 1:02am UTC](https://discuss.elastic.co/t/creating-a-unique-count-histogram/141269/1 "2018-07-24T01:02:10Z")

</div>

I am trying to make a histogram with unique counts for a given field (lets call this field Source). However, it seems Kibana only treats Source as unique within each bucket of the histogram, but not between buckets. How can I make the histogram pick a unique record (preferably, one with a maximum value of the field I am making the histogram for) for each Source?

Lets say my data looks like the following:

```
Source ActivityCount
A 10
A 30
B 50
B 20
C 50

```

I want to create a histogram that would describe the following subset of the data:

```
Source ActivityCount
A 30
B 50
C 50

```

It seems like this should be trivial to do, am I missing something very basic here?

---

<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: [July 24, 2018, 9:42pm UTC](https://discuss.elastic.co/t/creating-a-unique-count-histogram/141269/2 "2018-07-24T21:42:33Z")

</div>

Hmm, couldn't you just choose max ActivityCount for the metric, and do a terms on the Source for the buckets?

---

<div class="post-metadata">

### Author: ![samh](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@samh](https://discuss.elastic.co/u/samh)
#### Post date: [July 24, 2018, 10:04pm UTC](https://discuss.elastic.co/t/creating-a-unique-count-histogram/141269/3 "2018-07-24T22:04:26Z")

</div>

So that's actually what I've done so far, verbatim. However, this is not a great way to visualize this data, particularly since the data set is quite large, so there are many values. I need to restructure this data into a histogram so that I can actually see how the data is distributed instead of looking at the individual values.

---

<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 21, 2018, 10:04pm UTC](https://discuss.elastic.co/t/creating-a-unique-count-histogram/141269/4 "2018-08-21T22:04:27Z")

</div>

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