# Creating a visualisation that Aggregates (combines?) 2 discrete fields in an index

**URL:** https://discuss.elastic.co/t/creating-a-visualisation-that-aggregates-combines-2-discrete-fields-in-an-index/204383
**Category:** Kibana
**Created:** [October 20, 2019, 10:43pm UTC](https://discuss.elastic.co/t/creating-a-visualisation-that-aggregates-combines-2-discrete-fields-in-an-index/204383 "2019-10-20T22:43:27Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![shaddowofadream](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaddowofadream/32/56227_2.png) [@shaddowofadream](https://discuss.elastic.co/u/shaddowofadream)
#### Post date: [October 20, 2019, 10:43pm UTC](https://discuss.elastic.co/t/creating-a-visualisation-that-aggregates-combines-2-discrete-fields-in-an-index/204383/1 "2019-10-20T22:43:27Z")

</div>

We are indexing our Web Proxy logs and have a large number of usable fields...

timestamp, URL visited, bytes transferred etc...

What I'd like to do is create a visualisation that aggregates the URL's by the sum of bytes transferred...

I can get a count of of URLS i.e. 50,000 hits to [facebook.com](http://facebook.com); 5,000 hits to [youtube.com](http://youtube.com) etc etc, but that doesn't show that those 5,000 hits to YouTube transferred 3x the amount of bandwidth

So what I'd like is to add-up all of the bytes transferred against {URLs} and do a top\_N results against that..

i.e.

URL1 --- 6,005,000 bytes  
URL2 --- 4,001,000 bytes  
URL3 --- 1,001,000 bytes

---

<div class="post-metadata">

### Author: ![shaddowofadream](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaddowofadream/32/56227_2.png) [@shaddowofadream](https://discuss.elastic.co/u/shaddowofadream)
#### Post date: [October 21, 2019, 12:44am UTC](https://discuss.elastic.co/t/creating-a-visualisation-that-aggregates-combines-2-discrete-fields-in-an-index/204383/2 "2019-10-21T00:44:10Z")

</div>

**Solved** 🙂

So after playing around with the Visualization interface I was able to achieve exactly what I needed, I'll document this below in-case anyone else is trying to achieve the same results...

- Create a new Visualization (type: TSVB)
- Top N
- Aggregation = **Sum** (on field _bytes_)
- Sub Aggregation = **Cumulative Sum** on same field (_bytes_) shows up as Sum of _bytes_
- Group by = Terms _URL_

This will then group the results by URL and provide the cumulative sum of those results 🙂

Perfect

---

<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: [November 18, 2019, 12:44am UTC](https://discuss.elastic.co/t/creating-a-visualisation-that-aggregates-combines-2-discrete-fields-in-an-index/204383/3 "2019-11-18T00:44:13Z")

</div>

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