# Average Aggregation

**URL:** <https://discuss.elastic.co/t/average-aggregation/67826>\
**Category:** Kibana\
**Created:** [December 2, 2016, 5:21am UTC](https://discuss.elastic.co/t/average-aggregation/67826 "2016-12-02T05:21:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![c0ng111](https://avatars.discourse-cdn.com/v4/letter/c/5e9695/32.png) [@c0ng111](https://discuss.elastic.co/u/c0ng111)\
**Post date:** [December 2, 2016, 5:21am UTC](https://discuss.elastic.co/t/average-aggregation/67826/1 "2016-12-02T05:21:47Z")

</div>

Hi,

Is there a way to aggregate the average with filtering the 0 values?

eg.

time - 1  
time - 0  
time - 2  
time - 1  
time - 3  
time - 2  
time - 0

on Kibana i see that getting the average would be below computation :  
(1+0+2+1+3+2+0) / 7 = 1.28

i want to compute the average excluding the zero's (0) values, below computation :  
(1+2+1+3+2) / 5 = 1.8

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![c0ng111](https://avatars.discourse-cdn.com/v4/letter/c/5e9695/32.png) [@c0ng111](https://discuss.elastic.co/u/c0ng111)\
**Post date:** [December 5, 2016, 7:25am UTC](https://discuss.elastic.co/t/average-aggregation/67826/2 "2016-12-05T07:25:36Z")

</div>

Hi again,

My scenario is I'm using "Vertical Bar Chart visualization" on Y-axis "Aggregation" -\> "Average" I want to exclude or remove zero's (0) from computation as example above.

Can I use "json inputs" to filter the zeor's(0)?

Thank you

---

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [December 5, 2016, 9:01pm UTC](https://discuss.elastic.co/t/average-aggregation/67826/3 "2016-12-05T21:01:17Z")

</div>

Hi Cocoi,

I think you want to filter the data used in the visualization. There's a couple of ways you can do this.

One is to create a saved search with a query like `time:>0` and then build whatever visualizations you want to with that Saved Search.

Another is to use that same query directly in the visualization.

I also tried putting the time\>0 filter in the advanced JSON input but didn't get that to work. But I could be doing something wrong.

Regards,  
Lee

---

<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:** [January 2, 2017, 9:01pm UTC](https://discuss.elastic.co/t/average-aggregation/67826/4 "2017-01-02T21:01:47Z")

</div>

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