# Kibana lens formula flexibility for histogram aggregation

**URL:** https://discuss.elastic.co/t/kibana-lens-formula-flexibility-for-histogram-aggregation/297184
**Category:** Kibana
**Tags:** lens
**Created:** [February 14, 2022, 7:30pm UTC](https://discuss.elastic.co/t/kibana-lens-formula-flexibility-for-histogram-aggregation/297184 "2022-02-14T19:30:39Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Samuel\_Wehrli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samuel_wehrli/32/78663_2.png) [@Samuel\_Wehrli](https://discuss.elastic.co/u/Samuel_Wehrli)
#### Post date: [February 14, 2022, 7:30pm UTC](https://discuss.elastic.co/t/kibana-lens-formula-flexibility-for-histogram-aggregation/297184/1 "2022-02-14T19:30:39Z")

</div>

Hi, I use the kibana lens formula feature to calculate cumulative sums as the denominator in a division. This works with date histograms. Unfortunately, using pipeline aggregations (such as cumulative sum) seems not possible for histogram aggregation (not dates, but numbers).

On the other hand side I can calculate cumulative sums for histogram aggregations with the aggregation visualizations. However, in this case, I cannot define more complicated expressions involving cumulative sums in divisions.

Either way I don't get what I really want: histogram aggregation + cumulative sum in a division.

I believe that bucket scripts handle my combined need on a script level. Is there a way to implement this on the level of visualizations?

---

<div class="post-metadata">

### Author: ![ghudgins](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ghudgins/32/138532_2.png) [@ghudgins](https://discuss.elastic.co/u/ghudgins)
#### Post date: [February 14, 2022, 11:05pm UTC](https://discuss.elastic.co/t/kibana-lens-formula-flexibility-for-histogram-aggregation/297184/2 "2022-02-14T23:05:03Z")

</div>

today TSVB is the editor that supports bucket scripts. we're working on ading more advanced functionality to Lens formulas and will get back to you about cumulative sum for number histograms!

---

<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: [March 14, 2022, 11:05pm UTC](https://discuss.elastic.co/t/kibana-lens-formula-flexibility-for-histogram-aggregation/297184/3 "2022-03-14T23:05:41Z")

</div>

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