# TSVB Visualisation get the filter date Value

**URL:** <https://discuss.elastic.co/t/tsvb-visualisation-get-the-filter-date-value/240309>\
**Category:** Kibana\
**Tags:** kql-kibana-query-language\
**Created:** [July 8, 2020, 9:07am UTC](https://discuss.elastic.co/t/tsvb-visualisation-get-the-filter-date-value/240309 "2020-07-08T09:07:50Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![umay\_fb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/umay_fb/32/60582_2.png) [@umay\_fb](https://discuss.elastic.co/u/umay_fb)\
**Post date:** [July 8, 2020, 9:07am UTC](https://discuss.elastic.co/t/tsvb-visualisation-get-the-filter-date-value/240309/1 "2020-07-08T09:07:50Z")

</div>

Hi All....

i want to create a Visualisation using TSVB. can we get a Day of time filter? exp: we get a minday = 1 , and maxday = 31 from time filter like this, or time interval of timefilter.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/b/db642298aff361bff8828e3bf578689d017d165a.png)

i need this value to calculate the achievment in script bucket or math.

thanks

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [July 8, 2020, 6:54pm UTC](https://discuss.elastic.co/t/tsvb-visualisation-get-the-filter-date-value/240309/2 "2020-07-08T18:54:26Z")

</div>

Hi @umay_fb.

I'm having trouble understanding your goal. Can you share more of your TSVB visualization with us? More screenshots would be helpful.

---

<div class="post-metadata">

**Author:** ![umay\_fb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/umay_fb/32/60582_2.png) [@umay\_fb](https://discuss.elastic.co/u/umay_fb)\
**Post date:** [July 9, 2020, 2:32am UTC](https://discuss.elastic.co/t/tsvb-visualisation-get-the-filter-date-value/240309/3 "2020-07-09T02:32:58Z")

</div>

I want to calculated the selling data. it using date in time picker.  
so the formula is (maxdaydatetimepicker-mindaydatetimepicker)/()maxdaytimepicker \*(revenue/targetrevenue)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/5/d54cb650beac2d55980d2a36886032d79e9b1587.png)  
from thia timepicker:  
mindaytimepicker:1  
maxdaytimepicker:31  
rev:3k  
targetrev:5k  
so if using time picker like that the formula : (31-1)\*(3k/5k).

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [July 9, 2020, 11:16pm UTC](https://discuss.elastic.co/t/tsvb-visualisation-get-the-filter-date-value/240309/4 "2020-07-09T23:16:07Z")

</div>

Hi @umay_fb. This was a great question. This is how I found the number of days (max date - min date). The `foo` aggregation was required to access the Math aggregation even though I never use it. The 86400000 parameter is the number of milliseconds in a day.

I hope this helps.

 ![Screenshot_2020-07-09 Memory Usage Metricbeat System ECS - Elastic(1)](https://us1.discourse-cdn.com/elastic/original/3X/f/b/fbae5ef5aba8098ac82b87df474bb5c5211c5b6e.png)

 ![Screenshot_2020-07-09 Memory Usage Metricbeat System ECS - Elastic(2)](https://us1.discourse-cdn.com/elastic/original/3X/9/7/97bf7c47cf683657d84d505f6fa99b1e23c9fde7.png)

---

<div class="post-metadata">

**Author:** ![umay\_fb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/umay_fb/32/60582_2.png) [@umay\_fb](https://discuss.elastic.co/u/umay_fb)\
**Post date:** [July 10, 2020, 8:14am UTC](https://discuss.elastic.co/t/tsvb-visualisation-get-the-filter-date-value/240309/5 "2020-07-10T08:14:14Z")

</div>

wow thanks for the answer..  
I just knew I could use it. but i get the different result like this..

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/4/9467771775387dbd8d91049ffe7c07f81ae1c211.png)

why i get 29.5 not 30? is that any wrong with my script? i use

(params.\_timestamp - params.\_all.foo.timestamps[0]) / 86400000

where i can get the documentation about timestamps tsvb kibana?

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [July 13, 2020, 3:53pm UTC](https://discuss.elastic.co/t/tsvb-visualisation-get-the-filter-date-value/240309/6 "2020-07-13T15:53:31Z")

</div>

In the Panel Options tab, change "Drop Last Bucket?" to "No".

---

<div class="post-metadata">

**Author:** ![umay\_fb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/umay_fb/32/60582_2.png) [@umay\_fb](https://discuss.elastic.co/u/umay_fb)\
**Post date:** [July 14, 2020, 3:46am UTC](https://discuss.elastic.co/t/tsvb-visualisation-get-the-filter-date-value/240309/7 "2020-07-14T03:46:54Z")

</div>

thanks for answer... why i cant use it when i use Data timerange mode a entire time range? i use this formula and get a zero value..

---

<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 11, 2020, 3:48am UTC](https://discuss.elastic.co/t/tsvb-visualisation-get-the-filter-date-value/240309/8 "2020-08-11T03:48:38Z")

</div>

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