# How to make a table report by grouped aggregation count?

**URL:** <https://discuss.elastic.co/t/how-to-make-a-table-report-by-grouped-aggregation-count/124977>\
**Category:** Kibana\
**Created:** [March 21, 2018, 12:11pm UTC](https://discuss.elastic.co/t/how-to-make-a-table-report-by-grouped-aggregation-count/124977 "2018-03-21T12:11:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kora](https://avatars.discourse-cdn.com/v4/letter/k/f6c823/32.png) [@kora](https://discuss.elastic.co/u/kora)\
**Post date:** [March 21, 2018, 12:11pm UTC](https://discuss.elastic.co/t/how-to-make-a-table-report-by-grouped-aggregation-count/124977/1 "2018-03-21T12:11:23Z")

</div>

Hi all.

This seems similar as [How to make histogram by grouped aggregation count?](https://discuss.elastic.co/t/how-to-make-histogram-by-grouped-aggregation-count/124709) to me that is nicely answered by @timroes.  
I have a data that I think has the same structure, although no integers here:

```
{ "action": "play", "user": "john", "content": "cnn" }
{ "action": "play", "user": "maria", "content": "cnn" }
{ "action": "play", "user": "john", "content": "bbc" }
{ "action": "play", "user": "maria", "content": "bbc" }
{ "action": "play", "user": "john", "content": "cnn" }
{ "action": "play", "user": "john", "content": "cnn" }
{ "action": "play", "user": "john", "content": "vh1" }

```

On that I create a table report to show me how many times the content is played using terms and split row

 ![kibana-table-report](https://us1.discourse-cdn.com/elastic/original/3X/c/b/cbfa423edbbd47291d3dc17c2e44105b480a50ca.png)

And this works nicely. For above data set this would give me:

```
cnn 4
bbc 2
vh1 1

```

But I also need another report to show the count of users that played this content. Since one user can play one content multiple times, I just want to see how many users have done the play action on content.  
For above data set this would the look like:

```
cnn 2
bbc 2
vh1 1

```

I actually need just the report so I choose data table which I can export to csv. I tried to do some sibling aggregations but I always end up without grouping. Can this be done in some other way?

Thanks

---

<div class="post-metadata">

**Author:** ![timroes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timroes/32/19712_2.png) [@timroes](https://discuss.elastic.co/u/timroes)\
**Post date:** [March 21, 2018, 1:09pm UTC](https://discuss.elastic.co/t/how-to-make-a-table-report-by-grouped-aggregation-count/124977/2 "2018-03-21T13:09:50Z")

</div>

Hi Petar,

that is actually way easier then the the referenced question 🙂

Just change the Metrics aggregation from _Count_ to _Unique count_ on the `user` field. That will now group by watched channel, but instead of showing the actual play documents, just count how many individual users existed that watched that channel, and will result in the required graph.

Cheers,  
Tim

---

<div class="post-metadata">

**Author:** ![kora](https://avatars.discourse-cdn.com/v4/letter/k/f6c823/32.png) [@kora](https://discuss.elastic.co/u/kora)\
**Post date:** [March 21, 2018, 1:39pm UTC](https://discuss.elastic.co/t/how-to-make-a-table-report-by-grouped-aggregation-count/124977/3 "2018-03-21T13:39:04Z")

</div>

Oh, wow. I did try something with unique count but I must have made some other changes and confused myself 🙂

Thanks @timroes, sorry for bothering

---

<div class="post-metadata">

**Author:** ![timroes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timroes/32/19712_2.png) [@timroes](https://discuss.elastic.co/u/timroes)\
**Post date:** [March 21, 2018, 1:40pm UTC](https://discuss.elastic.co/t/how-to-make-a-table-report-by-grouped-aggregation-count/124977/4 "2018-03-21T13:40:26Z")

</div>

Absolutely no issue, that's what we are here for 🙂

Always feel free to come back with further questions.

---

<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:** [April 18, 2018, 1:40pm UTC](https://discuss.elastic.co/t/how-to-make-a-table-report-by-grouped-aggregation-count/124977/5 "2018-04-18T13:40:26Z")

</div>

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