# Visual Builder Can't use overall aggregation as input to another aggregation

**URL:** <https://discuss.elastic.co/t/visual-builder-cant-use-overall-aggregation-as-input-to-another-aggregation/92152>\
**Category:** Kibana\
**Created:** [July 6, 2017, 5:53pm UTC](https://discuss.elastic.co/t/visual-builder-cant-use-overall-aggregation-as-input-to-another-aggregation/92152 "2017-07-06T17:53:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![clowder](https://avatars.discourse-cdn.com/v4/letter/c/ecb155/32.png) [@clowder](https://discuss.elastic.co/u/clowder)\
**Post date:** [July 6, 2017, 5:53pm UTC](https://discuss.elastic.co/t/visual-builder-cant-use-overall-aggregation-as-input-to-another-aggregation/92152/1 "2017-07-06T17:53:10Z")

</div>

I am dealing with data regarding user success rates for performing different tasks. What I'd like to do is use the experimental visualization builder to create a metric visualization. I use a calculation aggregation to sum the number of success across all dates in range with the corresponding number of failures and then have that divide the number of successes to get a success rate. Just using the sum aggregation only allows me to use the data from the last day. I want to then use an overall sum to sum each of the days totals together so that I can get an accurate success rate. However, I can't then use that overall sum as an input to the aforementioned sum aggregation.

---

<div class="post-metadata">

**Author:** ![thomasneirynck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomasneirynck/32/23313_2.png) [@thomasneirynck](https://discuss.elastic.co/u/thomasneirynck)\
**Post date:** [July 7, 2017, 5:24pm UTC](https://discuss.elastic.co/t/visual-builder-cant-use-overall-aggregation-as-input-to-another-aggregation/92152/2 "2017-07-07T17:24:02Z")

</div>

hi @clowder,

you are referring to the Time Series Visual Builder?

What are you trying to express? Do you want to see that success-rate over time? I'm not sure if I fully understand the use case, but you might be able to do this with Timelion. It allows you to divide two time-series, to get the success-rate.

I'd suggest to look at the docs first, since this may get your there:

- [https://www.elastic.co/guide/en/kibana/current/timelion.html](https://www.elastic.co/guide/en/kibana/current/timelion.html)
- [https://www.elastic.co/blog/timelion-timeline](https://www.elastic.co/blog/timelion-timeline)

---

<div class="post-metadata">

**Author:** ![clowder](https://avatars.discourse-cdn.com/v4/letter/c/ecb155/32.png) [@clowder](https://discuss.elastic.co/u/clowder)\
**Post date:** [July 7, 2017, 5:33pm UTC](https://discuss.elastic.co/t/visual-builder-cant-use-overall-aggregation-as-input-to-another-aggregation/92152/3 "2017-07-07T17:33:11Z")

</div>

Thanks for the reply @thomasneirynck,

Yes I am referring to the Time Series Builder. What I'd like is to have a metric visualization (just a big bold number) that is the percentage success rate for all users. Let's say on Monday John tried to do task X 20 times and failed 10 times, thus succeeding 10 time. Marry then tried X 40 times on Tuesday and failed 5 times, succeeding 35 times. I want to be able to display on my dashboard that over Monday and Tuesday the success rate for X was (35 + 10)/(10+10 + 5+35) = 75%. Timelion wouldn't work because, as I understand it, it produces time series. I don't need a time series. I want to ask questions like what was the success rate for task X over the last two years. I can already graph the success rate as a time series. I just want to be able to do what I described. It seems to me this should be a fairly common use case.

---

<div class="post-metadata">

**Author:** ![thomasneirynck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomasneirynck/32/23313_2.png) [@thomasneirynck](https://discuss.elastic.co/u/thomasneirynck)\
**Post date:** [July 7, 2017, 5:58pm UTC](https://discuss.elastic.co/t/visual-builder-cant-use-overall-aggregation-as-input-to-another-aggregation/92152/4 "2017-07-07T17:58:28Z")

</div>

thanks @clowder,

I see, that's harder... 😉

Doing a division like that on the fly isn't possible, neither with TSVB or the regular metrics in Visualize.

Could you create an enhancement request in Kibana [https://github.com/elastic/kibana/issues/new](https://github.com/elastic/kibana/issues/new)?

---

<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:** [August 4, 2017, 5:58pm UTC](https://discuss.elastic.co/t/visual-builder-cant-use-overall-aggregation-as-input-to-another-aggregation/92152/5 "2017-08-04T17:58:42Z")

</div>

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

---

<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:** [August 17, 2017, 5:01pm UTC](https://discuss.elastic.co/t/visual-builder-cant-use-overall-aggregation-as-input-to-another-aggregation/92152/6 "2017-08-17T17:01:15Z")

</div>

Visual Builder (TSVB) does have the `Filter Ratio` aggregation. While it does create a time series, it also shows a gauge and has markdown output. If you set your Interval as large as your timespan then you effectively get the single value that represents the whole timestpan.

> [@Doing Math over count of events](https://discuss.elastic.co/t/doing-math-over-count-of-events/97278/6):
>
> Do all your docs have either success or failure? If so, then the visual builder screen I showed should work because it's doing transactionStatus:success/\* In this case \* means all docs, which is both success and failure. If some of your docs don't have either success or failure, then we'll need to use something other than \* for the denominator.

---

<div class="post-metadata">

**Author:** ![simianhacker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simianhacker/32/3383_2.png) [@simianhacker](https://discuss.elastic.co/u/simianhacker)\
**Post date:** [August 29, 2017, 4:32pm UTC](https://discuss.elastic.co/t/visual-builder-cant-use-overall-aggregation-as-input-to-another-aggregation/92152/7 "2017-08-29T16:32:36Z")

</div>

This PR should give you the ability to do what you're looking for: [https://github.com/elastic/kibana/pull/13681](https://github.com/elastic/kibana/pull/13681)
