# Visualizing the percentages of each count range

**URL:** <https://discuss.elastic.co/t/visualizing-the-percentages-of-each-count-range/201036>\
**Category:** Kibana\
**Created:** [September 25, 2019, 12:59pm UTC](https://discuss.elastic.co/t/visualizing-the-percentages-of-each-count-range/201036 "2019-09-25T12:59:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![WishTripES](https://avatars.discourse-cdn.com/v4/letter/w/848f3c/32.png) [@WishTripES](https://discuss.elastic.co/u/WishTripES)\
**Post date:** [September 25, 2019, 12:59pm UTC](https://discuss.elastic.co/t/visualizing-the-percentages-of-each-count-range/201036/1 "2019-09-25T12:59:42Z")

</div>

Hi  
We have an index with the following fields:

- UserID
- message
- Date/time of message

What we want is to answer the question "what percentage of users posted only 1 message, 2-5 messages, 6-10 messages, 11-100 messages and more than 100.

To count the number of messages per user is easy.

I just can't figure out how to do an aggregation on a previous aggregation in Kibana.

Thanks for any help

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [September 25, 2019, 1:28pm UTC](https://discuss.elastic.co/t/visualizing-the-percentages-of-each-count-range/201036/2 "2019-09-25T13:28:57Z")

</div>

Hi @WishTripES,

One way to do this is with [data frame transforms](https://www.elastic.co/guide/en/elastic-stack-overview/current/ecommerce-dataframes.html) - this allows you to create a "pivot" index which does the first part of the aggregation (grouping by userid, resulting in an index containing "UserId" and value count of documents per user). Then you can do a regular Ranges aggregation on top of the pivot index

---

<div class="post-metadata">

**Author:** ![WishTripES](https://avatars.discourse-cdn.com/v4/letter/w/848f3c/32.png) [@WishTripES](https://discuss.elastic.co/u/WishTripES)\
**Post date:** [September 25, 2019, 1:56pm UTC](https://discuss.elastic.co/t/visualizing-the-percentages-of-each-count-range/201036/3 "2019-09-25T13:56:54Z")

</div>

Thanks - I'll check it out

---

<div class="post-metadata">

**Author:** ![S\_K](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@S\_K](https://discuss.elastic.co/u/S_K)\
**Post date:** [October 2, 2019, 8:25am UTC](https://discuss.elastic.co/t/visualizing-the-percentages-of-each-count-range/201036/4 "2019-10-02T08:25:51Z")

</div>

Hi,

We are using ElasticSearch on AWS and the Machine Learning feature including the Data Frames are not available. Is there any other way to achieve aggregations of aggregations without data Frames?

Thank you

---

<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:** [October 30, 2019, 8:25am UTC](https://discuss.elastic.co/t/visualizing-the-percentages-of-each-count-range/201036/5 "2019-10-30T08:25:53Z")

</div>

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