# Calculate % in TSVB

**URL:** <https://discuss.elastic.co/t/calculate-in-tsvb/239932>\
**Category:** Kibana\
**Created:** [July 5, 2020, 5:55pm UTC](https://discuss.elastic.co/t/calculate-in-tsvb/239932 "2020-07-05T17:55:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [July 5, 2020, 5:55pm UTC](https://discuss.elastic.co/t/calculate-in-tsvb/239932/1 "2020-07-05T17:55:39Z")

</div>

This is how my data which is compile over time.

every five min sample, one record is as below, I have hundreds of systems.

system name: sys1,  
total cpus = integer  
used cpus = integer  
free cpus = integer

would like to get % free cpu per last sample  
that should be ((sum of free cpus / sum of total cpus) \*100)

I know it can only be achieved in tsvb  
how do I get this ?

[https://www.elastic.co/blog/how-to-display-data-as-a-percentage-in-kibana-visualizations](https://www.elastic.co/blog/how-to-display-data-as-a-percentage-in-kibana-visualizations)

I have already check this link out. this is for total count of document from everything and it does work. I have used that on other use case.

but this example is not usable for me because I need sum of free cpus/sum of total capacity over 5m interval.

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [July 6, 2020, 5:40pm UTC](https://discuss.elastic.co/t/calculate-in-tsvb/239932/2 "2020-07-06T17:40:13Z")

</div>

Anyone?

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [July 6, 2020, 8:21pm UTC](https://discuss.elastic.co/t/calculate-in-tsvb/239932/3 "2020-07-06T20:21:43Z")

</div>

this is more detail. I am after creating gauge or metrix in %

I have a two type of record  
rack1: cpu/gpu  
each has capacity, free,used

{  
rack1  
cpu  
@timestamp  
capacity:100  
free: 50  
used: 50  
}

{  
rack2  
cpu  
@timestamp  
capacity: 10  
free: 9  
used: 1  
}

so in this two record I should see  
free % = (50+1 / 110 ) \* 100 = 46.36%

How do I do this tsvb?

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [July 7, 2020, 1:27pm UTC](https://discuss.elastic.co/t/calculate-in-tsvb/239932/4 "2020-07-07T13:27:21Z")

</div>

giving bump to see anyone come acorss this problem

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [July 9, 2020, 4:23pm UTC](https://discuss.elastic.co/t/calculate-in-tsvb/239932/5 "2020-07-09T16:23:36Z")

</div>

one last try. if anyone has done anything like this before

---

<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 6, 2020, 4:35pm UTC](https://discuss.elastic.co/t/calculate-in-tsvb/239932/6 "2020-08-06T16:35:48Z")

</div>

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