Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
srikanthpabbu
Partner - Contributor
Partner - Contributor

Qlik Sense custom field in script using dates between today and future

Hello ,

I have a date field and on top of it i am expecting to have custom field to filter my data with specifics such as 'next 4 weeks' ,'next 8 weeks', beyond 8 weeks'. This is an additional field i want to use on filter pane.

In the script i have created below if statement 

if(Date(Date#([Date], 'MM/DD/YYYY') ,'MM/DD/YYYY') > weekstart(today()) and Date(Date#([Date], 'MM/DD/YYYY') ,'MM/DD/YYYY')< weekstart(addmonths(weekstart(today()),1)),'Next 4 Weeks',
IF(Date(Date#([Date], 'MM/DD/YYYY') ,'MM/DD/YYYY') > weekstart(today()) and Date(Date#([Date], 'MM/DD/YYYY') ,'MM/DD/YYYY')< weekstart(addmonths(weekstart(today()),2)), 'Next 8 Weeks',
IF(Date(Date#([Date], 'MM/DD/YYYY') ,'MM/DD/YYYY') > weekstart(addmonths(weekstart(today()),2)),'Beyond 2-Month',Date(Date)))) as Time_Series

after loading the data ,when i select 'Next 4 Weeks' date values seems to be fine and when 'Next 8 Weeks' is selected i am only getting dates beyond 'Next 4 Weeks'  date values ?

how do i change above statement to get proper dates for each filter pane user selection ?

Thanks in advance 

-Srikanth

 

 

 

 

 

Labels (3)
1 Reply
srikanthpabbu
Partner - Contributor
Partner - Contributor
Author

any help is appreciated .. I am looking for field which i can filter date between few periods. My if statement used is mentioned above .