# Create a histogram of filtered data

**URL:** <https://discuss.elastic.co/t/create-a-histogram-of-filtered-data/82224>\
**Category:** Kibana\
**Created:** [April 12, 2017, 8:39pm UTC](https://discuss.elastic.co/t/create-a-histogram-of-filtered-data/82224 "2017-04-12T20:39:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kmrychl](https://avatars.discourse-cdn.com/v4/letter/k/b5a626/32.png) [@kmrychl](https://discuss.elastic.co/u/kmrychl)\
**Post date:** [April 12, 2017, 8:39pm UTC](https://discuss.elastic.co/t/create-a-histogram-of-filtered-data/82224/1 "2017-04-12T20:39:13Z")

</div>

I created an X-Axis Aggregation of Range with my Field having values from 0 to 1, which gives me a count of the number of documents that fits that range.

Now, I want to make a histogram of that...I tried to do a sub-aggregation, but it didn't work

Any ideas?

---

<div class="post-metadata">

**Author:** ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)\
**Post date:** [April 12, 2017, 10:37pm UTC](https://discuss.elastic.co/t/create-a-histogram-of-filtered-data/82224/2 "2017-04-12T22:37:07Z")

</div>

Can you plz try a histogram with your data first of the filtered data and then add a bucket for sub aggregation. Which version of Kibana are you using ?

Thanks  
Rashmi

---

<div class="post-metadata">

**Author:** ![kmrychl](https://avatars.discourse-cdn.com/v4/letter/k/b5a626/32.png) [@kmrychl](https://discuss.elastic.co/u/kmrychl)\
**Post date:** [April 13, 2017, 2:40am UTC](https://discuss.elastic.co/t/create-a-histogram-of-filtered-data/82224/3 "2017-04-13T02:40:20Z")

</div>

Yes, I've done that. However, it's the sub bucket that doesn't change anything. It just keeps it as the one block and I believe its because the filter still exists, so it keeps my range. I can add a snapshot tomorrow when I'm logged on my system.

---

<div class="post-metadata">

**Author:** ![kmrychl](https://avatars.discourse-cdn.com/v4/letter/k/b5a626/32.png) [@kmrychl](https://discuss.elastic.co/u/kmrychl)\
**Post date:** [April 13, 2017, 1:45pm UTC](https://discuss.elastic.co/t/create-a-histogram-of-filtered-data/82224/5 "2017-04-13T13:45:16Z")

</div>

All set, I was sub aggregating the wrong way. Thanks for suggestion!

---

<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:** [May 11, 2017, 1:49pm UTC](https://discuss.elastic.co/t/create-a-histogram-of-filtered-data/82224/6 "2017-05-11T13:49:29Z")

</div>

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