# Daily Average Count visualization help

**URL:** https://discuss.elastic.co/t/daily-average-count-visualization-help/160831
**Category:** Kibana
**Created:** [December 14, 2018, 1:05am UTC](https://discuss.elastic.co/t/daily-average-count-visualization-help/160831 "2018-12-14T01:05:38Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Inammathe\_Inna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/inammathe_inna/32/40656_2.png) [@Inammathe\_Inna](https://discuss.elastic.co/u/Inammathe_Inna)
#### Post date: [December 14, 2018, 1:05am UTC](https://discuss.elastic.co/t/daily-average-count-visualization-help/160831/1 "2018-12-14T01:05:38Z")

</div>

Hi guys,

I've only just started visualizing some data for my work and I was hoping someone could advise how to best go about this request:

> - For each error code there is a comparison count of Current Day errors to daily Average using previous 7 days.

So in my data, every document has an error code associated with it (0 being no error).

Is there a nice way to visualize this data? perhaps in a data table? I know I need to split the data on the errorNo term however I am a bit lost trying to figure out which type of bucket aggregation I should be using to do the comparison of current day to the past 7 days daily average.

My first guess is something with the Average Bucket aggregation type but I don't know what Sub Aggregation would be correct.

Any tips?

Thank you 🙂

---

<div class="post-metadata">

### Author: ![Inammathe\_Inna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/inammathe_inna/32/40656_2.png) [@Inammathe\_Inna](https://discuss.elastic.co/u/Inammathe_Inna)
#### Post date: [December 14, 2018, 4:43am UTC](https://discuss.elastic.co/t/daily-average-count-visualization-help/160831/2 "2018-12-14T04:43:26Z")

</div>

Actually I think I just figured this out. 😃

I used a Data Table to visualize this:

## Metrics

### Sum Bucket Metric

1. Sum Bucket Aggregation
2. Date Range Aggregation
3. @timestamp Field
4. From: now/d-10 To: now

### Average Bucket Metric

1. Average Bucket Aggregation
2. Date Histogram Aggregation
3. @timestamp Field
4. Daily Interval

## Buckets

1. Split Rows
2. Terms Aggregation
3. errorNo field
4. Order by Custom Metric: Count

👍

---

<div class="post-metadata">

### Author: ![Inammathe\_Inna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/inammathe_inna/32/40656_2.png) [@Inammathe\_Inna](https://discuss.elastic.co/u/Inammathe_Inna)
#### Post date: [December 14, 2018, 4:45am UTC](https://discuss.elastic.co/t/daily-average-count-visualization-help/160831/3 "2018-12-14T04:45:56Z")

</div>

Might also mention: [date range visualization should default to desktop timezone #14450](https://github.com/elastic/kibana/issues/14450)

Ran into this issue when doing the Sum Bucket Aggregation. Would be nice if `now` used the browser's TimeZone (or whatever was specified in the Kibana general settings)

---

<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 11, 2019, 4:45am UTC](https://discuss.elastic.co/t/daily-average-count-visualization-help/160831/4 "2019-01-11T04:45:57Z")

</div>

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