# Sum of last complete Bucket as a single metric

**URL:** <https://discuss.elastic.co/t/sum-of-last-complete-bucket-as-a-single-metric/314936>\
**Category:** Kibana\
**Created:** [September 22, 2022, 11:05am UTC](https://discuss.elastic.co/t/sum-of-last-complete-bucket-as-a-single-metric/314936 "2022-09-22T11:05:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![smueller](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@smueller](https://discuss.elastic.co/u/smueller)\
**Post date:** [September 22, 2022, 11:05am UTC](https://discuss.elastic.co/t/sum-of-last-complete-bucket-as-a-single-metric/314936/1 "2022-09-22T11:05:48Z")

</div>

hi,  
im looking for a way to display the sum of all values from the last complete bucket of a timeseries.  
the idea is to display the current sum of all memory ,cores ,requests,disk space, etc. used for a server farm in a table visualisation, to get a overview for a drilldown.  
.  
for a tsvb graph, you set 'drop last bucket' and display the series sum of 'max used heap' per agent.hostname:

 ![scrsh](https://us1.discourse-cdn.com/elastic/original/3X/9/0/9054f9893a8cb5e70c8ad360d83366358debcf23.jpeg)  
and you get the number in the legend.  
how can i get this number in a 'markdown' or 'table' display? (markdown is problematic as it only allows you to gather 2 metrics )

---

<div class="post-metadata">

**Author:** ![Marta\_Bondyra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marta_bondyra/32/102122_2.png) [@Marta\_Bondyra](https://discuss.elastic.co/u/Marta_Bondyra)\
**Post date:** [September 27, 2022, 9:04am UTC](https://discuss.elastic.co/t/sum-of-last-complete-bucket-as-a-single-metric/314936/2 "2022-09-27T09:04:24Z")

</div>

If you know the bucket size (for example, a day, or 30m), would it be ok for you to use Lens in 8.5 (it will be released in 1-2 weeks?

You could use metric or datatable visualization and formula:

 ![Screenshot 2022-09-27 at 11.03.46](https://us1.discourse-cdn.com/elastic/original/3X/d/7/d728eed1ae48f18d9df01b1c8a202ddeaa9b23ea.jpeg)

---

<div class="post-metadata">

**Author:** ![Marta\_Bondyra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marta_bondyra/32/102122_2.png) [@Marta\_Bondyra](https://discuss.elastic.co/u/Marta_Bondyra)\
**Post date:** [September 27, 2022, 9:10am UTC](https://discuss.elastic.co/t/sum-of-last-complete-bucket-as-a-single-metric/314936/3 "2022-09-27T09:10:37Z")

</div>

And for tsvb you can use math to calculate your value not inside markdown but before:

 ![Screenshot 2022-09-27 at 11.10.20](https://us1.discourse-cdn.com/elastic/original/3X/5/5/5523b2685138c7d0138d106b58fa817c376ac87c.jpeg)  
 ![Screenshot 2022-09-27 at 11.10.14](https://us1.discourse-cdn.com/elastic/original/3X/8/7/879ce832e489a85bc82bb702397e67e02e6fc603.jpeg)

---

<div class="post-metadata">

**Author:** ![smueller](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@smueller](https://discuss.elastic.co/u/smueller)\
**Post date:** [October 20, 2022, 9:41am UTC](https://discuss.elastic.co/t/sum-of-last-complete-bucket-as-a-single-metric/314936/4 "2022-10-20T09:41:16Z")

</div>

Hi Thanks for the response. But i think there are some misunderstandings here.  
i don't want to add hdd space and ram.  
I'm trying to get the number indicated in the screenshot in a view that allows me to display lots of these values

 ![screenshot2](https://us1.discourse-cdn.com/elastic/original/3X/2/3/237ee18a0035033ec3a8bccce54e71b8b32c0feb.jpeg)  
which is the sum of heap used by all servers from the last complete bucket. (i want to repeat that for other metrics aswell).  
tsvb has the neat trick of "dropping the last bucket" so you don't see incomplete results(a otherwise the graph would always drop towards the end.)  
but since i don't know the bucket size, i don't see any other solution than this one here:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/6/26607078269b2b8939790cdcea12ccf5e98bae3a.jpeg)  
and setting tsvb panel options to "last value" and 'drop last bucket'

edit: i just noticed, that in tsvb markdown you can select many metrics, not just two like in the "timeseries"or "metric" display, so i think, i got what i wanted

or is there any other way to get the 'last full bucket for all hosts and one metric' in other visualisations (maybe vega)?  
best regards

---

<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 17, 2022, 9:41am UTC](https://discuss.elastic.co/t/sum-of-last-complete-bucket-as-a-single-metric/314936/5 "2022-11-17T09:41:55Z")

</div>

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