# Visualize Group by result

**URL:** <https://discuss.elastic.co/t/visualize-group-by-result/262793>\
**Category:** Kibana\
**Created:** [February 1, 2021, 7:47am UTC](https://discuss.elastic.co/t/visualize-group-by-result/262793 "2021-02-01T07:47:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![deeksha39](https://avatars.discourse-cdn.com/v4/letter/d/c2a13f/32.png) [@deeksha39](https://discuss.elastic.co/u/deeksha39)\
**Post date:** [February 1, 2021, 7:47am UTC](https://discuss.elastic.co/t/visualize-group-by-result/262793/1 "2021-02-01T07:47:43Z")

</div>

Hi,  
I am working on a large dataset with 20000 rows and 40 columns, I want to group by my data based on 10 categorical columns, then I want to create a histogram and percentiles graph to make a comparison between the top 2 groups based on a count

---

<div class="post-metadata">

**Author:** ![afharo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/afharo/32/75202_2.png) [@afharo](https://discuss.elastic.co/u/afharo)\
**Post date:** [February 1, 2021, 2:26pm UTC](https://discuss.elastic.co/t/visualize-group-by-result/262793/2 "2021-02-01T14:26:30Z")

</div>

Hi @deeksha39,

My understanding is that you are after creating a dashboard containing a couple of panes:

1. A table of 10 columns
2. A histogram
3. A percentiles graph

Is that correct?

NB: You can sort your buckets (groups) by the top count using the Sort property in the bucket's options.

---

<div class="post-metadata">

**Author:** ![deeksha39](https://avatars.discourse-cdn.com/v4/letter/d/c2a13f/32.png) [@deeksha39](https://discuss.elastic.co/u/deeksha39)\
**Post date:** [February 2, 2021, 4:35am UTC](https://discuss.elastic.co/t/visualize-group-by-result/262793/3 "2021-02-02T04:35:00Z")

</div>

Hi Afharo,  
Thank you for your response, Yes I want to create a dashboard where I want two visualizations

1. Histogram
2. Percentiles Graph  
But for each visualization, I want to group by my data based on 10 categorical columns region, country, city, usage\_cat etc, after grouping the data, I want to pick the 2 groups with the highest count and want a grouped histogram for these 2 groups data.  
Similarly for percentiles, after picking 2 highest count groups I want to show the percentile difference between these two groups

---

<div class="post-metadata">

**Author:** ![afharo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/afharo/32/75202_2.png) [@afharo](https://discuss.elastic.co/u/afharo)\
**Post date:** [February 2, 2021, 10:42am UTC](https://discuss.elastic.co/t/visualize-group-by-result/262793/4 "2021-02-02T10:42:19Z")

</div>

I understand now! Thanks for explaining! I don't think the core visualizations in Kibana allow you to do that _smart_ column selection at the moment. For this type of advanced handling of the data, you might want to take a look at Canvas and their expression language or Vega.

Q: By highest count, do you mean the highest number of documents? If so, wouldn't "country" always be selected over city or region? Or are you referring to the highest number of _categories_ in that group? (which, then, it will always be the smallest region). I'm interested in this type of dynamic aggregation and want to know more 😇

---

<div class="post-metadata">

**Author:** ![deeksha39](https://avatars.discourse-cdn.com/v4/letter/d/c2a13f/32.png) [@deeksha39](https://discuss.elastic.co/u/deeksha39)\
**Post date:** [February 2, 2021, 11:00am UTC](https://discuss.elastic.co/t/visualize-group-by-result/262793/5 "2021-02-02T11:00:52Z")

</div>

Hi Afharo,  
To answer your question, by highest count, I mean group containing the highest number of documents, Like there are 10 categorical columns on which want to group by starting from the region(North/ South), then country, city, usage category, brand, subbrand, configuration, sub configuration etc, so for example, if after group by we get 20 groups, I want to pick 2 groups where the count of documents are highest and want to plot a histogram to make a comparison between data of these two groups,

One visualization (bar plot) to make a comparison between (10, 50,90 ) percentiles of these two groups. For this plot, I am not able to find anything to compute nth percentile for aggregate in vega-lite

---

<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:** [March 2, 2021, 11:00am UTC](https://discuss.elastic.co/t/visualize-group-by-result/262793/6 "2021-03-02T11:00:59Z")

</div>

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