# Applying global Time filter within a visualization to other dates

**URL:** <https://discuss.elastic.co/t/applying-global-time-filter-within-a-visualization-to-other-dates/273248>\
**Category:** Kibana\
**Created:** [May 18, 2021, 8:00am UTC](https://discuss.elastic.co/t/applying-global-time-filter-within-a-visualization-to-other-dates/273248 "2021-05-18T08:00:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas\_Pierrot](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomas_pierrot/32/78397_2.png) [@Thomas\_Pierrot](https://discuss.elastic.co/u/Thomas_Pierrot)\
**Post date:** [May 18, 2021, 8:00am UTC](https://discuss.elastic.co/t/applying-global-time-filter-within-a-visualization-to-other-dates/273248/1 "2021-05-18T08:00:01Z")

</div>

Hi,  
I'm creating a visualization and I need to filter some dates using the same time range selected in the time picker and I simply don't know how to do so.

Basically, I'm creating a visualization based on an index that contains several dates.  
The "main" one, `event_date` is filtered by the selected date range (top right of the screen).

I'd like to apply this selected date range to another date (`sub_event_date`) within the visualization.  
In other terms, I'd like to know what to write for `lt` and `gte` in order to inherit global time range.

```auto
        {
          "range": {
        "sub_event_date": {
          "gte": "??? Inherit global time range",
          "lt": "??? Inherit global time range"
        }
          }
        }

```

I could not find anything on this topic. Is it something possible ?

Thanks a lot for your answers.

Thanks

---

<div class="post-metadata">

**Author:** ![dosant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dosant/32/64489_2.png) [@dosant](https://discuss.elastic.co/u/dosant)\
**Post date:** [May 18, 2021, 12:59pm UTC](https://discuss.elastic.co/t/applying-global-time-filter-within-a-visualization-to-other-dates/273248/2 "2021-05-18T12:59:36Z")

</div>

Hi @Thomas_Pierrot, welcome to the community 👋

You can get current global time range from time filter service in data plugin:

> <https://github.com/elastic/kibana/blob/5c3527d8a63deefd4fc3ef2d4b5e7381f6c34422/src/plugins/data/public/query/timefilter/timefilter.ts#L103>

Then you can use it to build your custom range filter

---

<div class="post-metadata">

**Author:** ![Thomas\_Pierrot](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomas_pierrot/32/78397_2.png) [@Thomas\_Pierrot](https://discuss.elastic.co/u/Thomas_Pierrot)\
**Post date:** [May 18, 2021, 1:30pm UTC](https://discuss.elastic.co/t/applying-global-time-filter-within-a-visualization-to-other-dates/273248/3 "2021-05-18T13:30:53Z")

</div>

Hi @dosant  
Thanks a lot for your answer.  
I'll try and let you know 🙂  
Thanks !

---

<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 15, 2021, 1:31pm UTC](https://discuss.elastic.co/t/applying-global-time-filter-within-a-visualization-to-other-dates/273248/4 "2021-06-15T13:31:28Z")

</div>

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