# Access dashboard date range in queries

**URL:** <https://discuss.elastic.co/t/access-dashboard-date-range-in-queries/106295>\
**Category:** Kibana\
**Created:** [November 3, 2017, 10:33am UTC](https://discuss.elastic.co/t/access-dashboard-date-range-in-queries/106295 "2017-11-03T10:33:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![varundbest](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/varundbest/32/48066_2.png) [@varundbest](https://discuss.elastic.co/u/varundbest)\
**Post date:** [November 3, 2017, 10:33am UTC](https://discuss.elastic.co/t/access-dashboard-date-range-in-queries/106295/1 "2017-11-03T10:33:28Z")

</div>

I have a date range set to field -\> field1  
Now I need to access the same range (Only upper bound) for another field -\> field2. Is it possible?  
Like :-  
{  
"script": {  
"script": "doc['field2'].value \>= doc['@DashboardTimeRange\_Until'].value"  
}  
},

Or Perhaps add a filter corresponding to Dashboard Time Range but for different field?

---

<div class="post-metadata">

**Author:** ![weltenwort](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weltenwort/32/53885_2.png) [@weltenwort](https://discuss.elastic.co/u/weltenwort)\
**Post date:** [November 3, 2017, 2:51pm UTC](https://discuss.elastic.co/t/access-dashboard-date-range-in-queries/106295/2 "2017-11-03T14:51:46Z")

</div>

Hi @varundbest,

the scripted fields are evaluated on the server side and can only access data from the single document. I don't see a way to access the current timepicker value. For now you would have to manually add a date range filter on `field2` and adjust its boundaries separately.

There is an ongoing effort to enable users to add input controls to dashboards. The first step was merged in [https://github.com/elastic/kibana/pull/13314](https://github.com/elastic/kibana/pull/13314). There are plans to add other controls such as [https://github.com/elastic/kibana/issues/14177](https://github.com/elastic/kibana/issues/14177). We are thankful for any further input you can provide in the form of feature request issues or comments.

---

<div class="post-metadata">

**Author:** ![varundbest](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/varundbest/32/48066_2.png) [@varundbest](https://discuss.elastic.co/u/varundbest)\
**Post date:** [November 3, 2017, 4:44pm UTC](https://discuss.elastic.co/t/access-dashboard-date-range-in-queries/106295/3 "2017-11-03T16:44:04Z")

</div>

Ability to add a filter to Dashboards with value taken from Time Range Picker would also be suffice for this functionality.

---

<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:** [December 1, 2017, 4:44pm UTC](https://discuss.elastic.co/t/access-dashboard-date-range-in-queries/106295/4 "2017-12-01T16:44:13Z")

</div>

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