Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
ArtemZadorozhnyi
Contributor II
Contributor II

Auto date range picker

Hi! 

Trying to set a default date range for my app - when opened I want it to automatically choose dates starting from the beginning of the current year and up to today's date. 

I've tried to use default bookmarks for that purpose - choosing "this year" in date picker and then setting this bookmark as a default one for the page, but it's static and will only hardcode the date range which is actual for the moment of creation and will need an adjustment next on the next day.

Thank you

Labels (1)
3 Replies
ali_hijazi
Partner - Master II
Partner - Master II

add a filter pane for your date field
open the filter pane and in the search input write the following:
=your_date >= YearStart(Today())
now create a bookmark and flag it as default
now you can delete the filter pane if you want
filter created is dynamic

ali_hijazi_0-1716279376190.png

 

I can walk on water when it freezes
TauseefKhan
Creator III
Creator III

Hi @ArtemZadorozhnyi,

To create an auto date range picker that dynamically selects the date range from the beginning of the current year up to today's date. 

Use the expression to get the start and end dates, Add it in the below Date field option: In Date Interval.
OR
You can creat Expression using you date Field as you requested.

vStartDate:=MakeDate(Year(Today()),1,1);
vEndDate:=Today();

TauseefKhan_0-1716279813209.png

*** When applicable please mark the correct/appropriate replies as "solution". Please LIKE threads if the provided solution is helpful to. ***

 

 

Sayed_Mannan
Creator II
Creator II

Assuming you have a date field [Order Date] which you're using to create year and month filters, you need to target this data field in your expression. Follow these steps:

In the search input for [Order Date], input the following expression:

=[Order Date] >= YearStart(max([Order Date])) and [Order Date] <= Max([Order Date])

This expression ensures that the [Order Date] is within the range of the start of the year to the maximum date in [Order Date].

After applying the above filter, create a bookmark of this selection for future use.

This approach allows you to dynamically filter data based on the year of the maximum [Order Date].

Remember to update the bookmark whenever the data changes.