# Metric aggregation visualization via kibana

**URL:** <https://discuss.elastic.co/t/metric-aggregation-visualization-via-kibana/64364>\
**Category:** Kibana\
**Created:** [October 30, 2016, 8:56am UTC](https://discuss.elastic.co/t/metric-aggregation-visualization-via-kibana/64364 "2016-10-30T08:56:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![higee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/higee/32/22343_2.png) [@higee](https://discuss.elastic.co/u/higee)\
**Post date:** [October 30, 2016, 8:56am UTC](https://discuss.elastic.co/t/metric-aggregation-visualization-via-kibana/64364/1 "2016-10-30T08:56:36Z")

</div>

Hi, I'm curious how I could visualize metric aggregation via kibana.

My data is as follows:

date price  
10/1 1  
10/1 1.5  
10/2 2.2  
10/2 2.3  
10/2 1.2  
10/3 2.3  
10/3 3.3  
...

Basically what I'm trying to do is count the number of documents per day and calculate cumulative sum. In the case shown above, the result would be:

date count cumulative\_count  
10/1 2 2  
10/2 3 5  
10/3 2 7

I could get the cumulative count via aggregation, and code is as follows:

> POST index/\_search  
> {  
> "size": 0,  
> "aggs" : {  
> "items\_sold\_per\_day" : {  
> "date\_histogram" : {  
> "field" : "date\_seoul",  
> "interval" : "month"  
> },  
> "aggs": {  
> "item\_sold\_cumulative": {  
> "cumulative\_sum": {  
> "buckets\_path": "\_count"  
> }  
> }  
> }  
> }  
> }  
> }

Now I'm stuck with how to visualize that result via Kibana.  
I want to show two things in the graph.

1. target goal
2. how much we have achieved  
in monthly term. (that's why I need cumulative count result)

Any idea or suggestion would be greatly helpful.

Best

Gee

---

<div class="post-metadata">

**Author:** ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)\
**Post date:** [October 31, 2016, 7:04pm UTC](https://discuss.elastic.co/t/metric-aggregation-visualization-via-kibana/64364/2 "2016-10-31T19:04:01Z")

</div>

You can achieve #2 using the `.cusum` function in Timelion. For #1 though, it would be tricky. You might have to create a separate data source with your target goals. You can chart multiple data sources in Timelion.

---

<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:** [July 6, 2017, 1:35pm UTC](https://discuss.elastic.co/t/metric-aggregation-visualization-via-kibana/64364/3 "2017-07-06T13:35:00Z")

</div>


