# TSVB Table - Using user selected time interval for calculation

**URL:** <https://discuss.elastic.co/t/tsvb-table-using-user-selected-time-interval-for-calculation/230379>\
**Category:** Kibana\
**Created:** [April 29, 2020, 1:44pm UTC](https://discuss.elastic.co/t/tsvb-table-using-user-selected-time-interval-for-calculation/230379 "2020-04-29T13:44:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![r\_santosh\_kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/r_santosh_kumar/32/47922_2.png) [@r\_santosh\_kumar](https://discuss.elastic.co/u/r_santosh_kumar)\
**Post date:** [April 29, 2020, 1:44pm UTC](https://discuss.elastic.co/t/tsvb-table-using-user-selected-time-interval-for-calculation/230379/1 "2020-04-29T13:44:57Z")

</div>

Hello Team,

[Kibana Version : 7.4.2]

I am creating a TSVB Table which looks as shown below  
(note: actual product names have been masked and replaced in the screenshot below)

 ![table](https://us1.discourse-cdn.com/elastic/original/3X/7/7/77b9201921aee690ff0762d6eff8b5626a5bd1f9.png)

The row data is to be read as: There are **109**"Prod-0" and was used **3919** times . Usage Per product is _Usage Count/Product Count_ (i.e. 3919/109 = 35.954). All this with time filter of "Last 30 Days".

Calculation of " **Usage per product per day**" is where I am stuck at. The calculation is simple: **usage count/product count/[user selected time filter]**  
Question: How to get the user selected "Time Interval" for calculation ? (in this case 30 days)  
What I have tried:  
Option-1: Bucket Script with _params.\_interval_ as "time interval". This doesn't work because _params.\_interval_ returns bucket interval and not user select Time Interval.  
Option-2: Derivative Aggregation. I tried to use derivative aggregation as shown in screenshot below but the result is always zero.

 ![derivative](https://us1.discourse-cdn.com/elastic/original/3X/f/1/f1b4f78c760e000ba2143013a3a808bf92fec20d.png)

So to repeat the question, Is there a way to use user selected "Time Interval" for calculation in TSVB.

Thanks,  
Santosh.

PS: I wanted data to be represented in tabular format and since there is calculation involved (like usage per product and usage per product per day) i have gone with TSVB Table as the option. I am open to suggestion of using any other visualization for same result.

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [May 4, 2020, 9:04pm UTC](https://discuss.elastic.co/t/tsvb-table-using-user-selected-time-interval-for-calculation/230379/2 "2020-05-04T21:04:11Z")

</div>

You want to be able to display the usage per day regardless of the user selected time interval? I'm afraid that might be impossible.

---

<div class="post-metadata">

**Author:** ![r\_santosh\_kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/r_santosh_kumar/32/47922_2.png) [@r\_santosh\_kumar](https://discuss.elastic.co/u/r_santosh_kumar)\
**Post date:** [May 5, 2020, 8:06am UTC](https://discuss.elastic.co/t/tsvb-table-using-user-selected-time-interval-for-calculation/230379/3 "2020-05-05T08:06:03Z")

</div>

Hello Marius,

Unfortunately that is what is my requirement - _to display the usage per day regardless of user selected time interval_.

Since it is not possible, for time being I am going with the alternative option of hard-coding the interval in the options pane 😟.

Santosh.

---

<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:** [June 2, 2020, 8:06am UTC](https://discuss.elastic.co/t/tsvb-table-using-user-selected-time-interval-for-calculation/230379/4 "2020-06-02T08:06:04Z")

</div>

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