# Visualize the difference of two groups of aggregation

**URL:** <https://discuss.elastic.co/t/visualize-the-difference-of-two-groups-of-aggregation/165071>\
**Category:** Kibana\
**Created:** [January 21, 2019, 2:47pm UTC](https://discuss.elastic.co/t/visualize-the-difference-of-two-groups-of-aggregation/165071 "2019-01-21T14:47:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dillinzser](https://avatars.discourse-cdn.com/v4/letter/d/b38774/32.png) [@dillinzser](https://discuss.elastic.co/u/dillinzser)\
**Post date:** [January 21, 2019, 2:47pm UTC](https://discuss.elastic.co/t/visualize-the-difference-of-two-groups-of-aggregation/165071/1 "2019-01-21T14:47:36Z")

</div>

Hi,

I have a sum aggregation with grouping based on terms with two different values. I have the Time Series visualization like this:

 ![timeseries3](https://us1.discourse-cdn.com/elastic/original/3X/5/4/547fdb50f872e1e9688224edee928958154e9073.png)

What I want is to have a graph displaying only the differences per bucket of the current two graphs. This far I couldn't manage to do it. Could someone suggest which way to go? Maybe use another type of visualization?

Cheers

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [January 21, 2019, 3:07pm UTC](https://discuss.elastic.co/t/visualize-the-difference-of-two-groups-of-aggregation/165071/2 "2019-01-21T15:07:31Z")

</div>

So you would like to display the difference between `in` and `out-partner` ? Can you give me an example on how a document looks to see if this is possible?

---

<div class="post-metadata">

**Author:** ![dillinzser](https://avatars.discourse-cdn.com/v4/letter/d/b38774/32.png) [@dillinzser](https://discuss.elastic.co/u/dillinzser)\
**Post date:** [January 21, 2019, 3:34pm UTC](https://discuss.elastic.co/t/visualize-the-difference-of-two-groups-of-aggregation/165071/3 "2019-01-21T15:34:39Z")

</div>

The documents have a field "SourceContext" with the possible values of "in" and "out-partner" and the field "ms" with a number value. I want to aggregate the "ms" values grouped by the "SourceContext" and then have the difference of the aggregated values. And display only the difference with a graph.

---

<div class="post-metadata">

**Author:** ![dillinzser](https://avatars.discourse-cdn.com/v4/letter/d/b38774/32.png) [@dillinzser](https://discuss.elastic.co/u/dillinzser)\
**Post date:** [January 22, 2019, 10:36am UTC](https://discuss.elastic.co/t/visualize-the-difference-of-two-groups-of-aggregation/165071/4 "2019-01-22T10:36:34Z")

</div>

I finally managed to achieve this using the Timelion visualization. There I have the .subtract() function with which I can display the difference of two timeseries.

I anyway still interested if this can be also achieved with the TimeSeries visualization.

---

<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:** [February 19, 2019, 10:43am UTC](https://discuss.elastic.co/t/visualize-the-difference-of-two-groups-of-aggregation/165071/5 "2019-02-19T10:43:08Z")

</div>

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