# TSVB or Lens visualization for monthly maximum of daily sum of a field value

**URL:** <https://discuss.elastic.co/t/tsvb-or-lens-visualization-for-monthly-maximum-of-daily-sum-of-a-field-value/380221>\
**Category:** Kibana\
**Created:** [July 17, 2025, 4:40pm UTC](https://discuss.elastic.co/t/tsvb-or-lens-visualization-for-monthly-maximum-of-daily-sum-of-a-field-value/380221 "2025-07-17T16:40:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![smondal](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@smondal](https://discuss.elastic.co/u/smondal)\
**Post date:** [July 17, 2025, 4:40pm UTC](https://discuss.elastic.co/t/tsvb-or-lens-visualization-for-monthly-maximum-of-daily-sum-of-a-field-value/380221/1 "2025-07-17T16:40:15Z")

</div>

I have an index called global\_gpu-\* with @timestamp and "gpu\_gflops" field among others. It simple enough to get the daily sum of "gpu\_glops" using "formula" option in lens as follows:  
sum(gpu\_gflops)/1000/1000

I get the total peta flops for the day. What I want is to have a visualization showing maximum for month calculated over these daily total petaflop values.

E.g. 1st July - sum(gpu\_gflops)/1000/1000 = 396  
2nd July - sum(gpu\_gflops)/1000/1000 = 340  
:  
:  
:  
31st July - sum(gpu\_gflops)/1000/1000 = 355

the monthly maximum for July should be 396. This needs o be done over all the months of a year. How can this be achieved using Lens or TSVB in Kibana?

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [July 17, 2025, 5:31pm UTC](https://discuss.elastic.co/t/tsvb-or-lens-visualization-for-monthly-maximum-of-daily-sum-of-a-field-value/380221/2 "2025-07-17T17:31:12Z")

</div>

Hi @smondal

What version are you on....

This could be pretty easy with ESQL

My quick test...

```auto
FROM logs-* 
| STATS count = COUNT() by time = BUCKET(@timestamp, 1h)
| STATS daily_max = MAX(count) by day = BUCKET(time, 1d)

```

 ![Screenshot 2025-07-17 at 10.52.44 AM](https://us1.discourse-cdn.com/elastic/original/3X/e/a/ea22bd0e77b72f49da11f1445d7c886f7cdb8c1a.png)

So yours would be something like

```auto
FROM metrics-*
| STATS daily_sum_gflops = (SUM(gpu_gflops)/1000.0/1000.0) by days = BUCKET(@timestamp, 1d)
| STATS monthly_max = MAX(daily_sum_gflops) by months = BUCKET(days, 1m)

```

And of course if this is a normal ongoing thing you could use a [transform](https://www.elastic.co/docs/explore-analyze/transforms) to pre-aggregate the data

---

<div class="post-metadata">

**Author:** ![smondal](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@smondal](https://discuss.elastic.co/u/smondal)\
**Post date:** [July 17, 2025, 6:00pm UTC](https://discuss.elastic.co/t/tsvb-or-lens-visualization-for-monthly-maximum-of-daily-sum-of-a-field-value/380221/3 "2025-07-17T18:00:14Z")

</div>

This worked perfectly. Thanks! I would also check out transform.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [July 17, 2025, 6:01pm UTC](https://discuss.elastic.co/t/tsvb-or-lens-visualization-for-monthly-maximum-of-daily-sum-of-a-field-value/380221/4 "2025-07-17T18:01:17Z")

</div>

Cool, Keep ESQL in mind from here on out can make some things drastically simpler and other things which could not be done... doable.
