# Is there a variable holding the time period which I can use in my formulas

**URL:** <https://discuss.elastic.co/t/is-there-a-variable-holding-the-time-period-which-i-can-use-in-my-formulas/102465>\
**Category:** Kibana\
**Created:** [October 2, 2017, 6:24pm UTC](https://discuss.elastic.co/t/is-there-a-variable-holding-the-time-period-which-i-can-use-in-my-formulas/102465 "2017-10-02T18:24:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mathias](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mathias/32/23176_2.png) [@mathias](https://discuss.elastic.co/u/mathias)\
**Post date:** [October 2, 2017, 6:24pm UTC](https://discuss.elastic.co/t/is-there-a-variable-holding-the-time-period-which-i-can-use-in-my-formulas/102465/1 "2017-10-02T18:24:51Z")

</div>

Hi,

I use Time Series Visual Builder and make a nice graph calculation throughput.  
It works fine when I use 1s resolution and 15 minutes time span.

When I change time span to lets say 6 hours kibana complains that there are to many buckets.  
The counters I use are stored in ES once per second.  
To make the graph smooth I would like to calculate the average over a couple of samples.  
(Average method does not work, I need to use sum)  
I would like to divide the sum of my counters with the time interval used when I set interval to "auto".  
Is there a variable I can use calculation aggregation?  
e.g params.value/time\_interval

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/e/6e32d220d71495d269631860cab3dcd9765fb617.png)

I can hardcode interval to 10s and the divide my formula with 10.  
params.value/10  
That works for short time periods.

but that does not work when I change time span. I think I need a variable to solve this.  
Is there a variable keeping track of time interval?

Something like this:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/7/e7f775c2cd79789d82c937dbb8441b43956dce73.png)

Here is an exampe:  
First I have Interval set to auto and I show last 15 minutes. Then the sum of all samples are 10 times to high.  
Seems like interval is set to 10 secs in this case

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/8/a821cde43a424683b142bb04d5d188a26e9f29e8.png)

When I show last hour I get the following result:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/4/84aac68d0dc92bf3f5cac46c57da222471dca72e.png)  
30 times higher than correct value.

Then I specify Interval = 1s. This gives correct result:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/f/4f6ff88dd1f72f93cd830f281f72d7d22dabcdeb.png)

So in the first case the variable I am searching for should have the value 10 and in the second case it should be 30.  
Then I could always calculate the correct value in the formula.  
Br Mathias

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [October 4, 2017, 3:50pm UTC](https://discuss.elastic.co/t/is-there-a-variable-holding-the-time-period-which-i-can-use-in-my-formulas/102465/2 "2017-10-04T15:50:14Z")

</div>

Hmm, I can't think of any way to accomplish this currently. Sorry!

---

<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 1, 2017, 3:50pm UTC](https://discuss.elastic.co/t/is-there-a-variable-holding-the-time-period-which-i-can-use-in-my-formulas/102465/3 "2017-11-01T15:50:28Z")

</div>

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