Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Selecting Dates based upon Input

I know I've seen this topic before but I'm looking to go a little farther.  What I am trying to do is allow for the user to input a start date and an end date and then click a button that will apply to filter and select only the dates between them.  That part is working.

I also want to select the previous year for the same time frame as well.

For example, if the start date is 1/7/2013 and the end date is 1/13/2013, I would like 1/7/13 - 1/13/13 selected as well as 1/7/12 - 1/13/12.

I am using a SELECT IN FIELD action on a button to do this.  The current search string is:

='>='&date(vStartDate) & '<=' & date(vEndDate)

That works.  Anyone know how to add to that to allow the previous year dates to be selected as well?  I have uploaded my sample. !

1 Solution

Accepted Solutions
sunny_talwar

Try this:

='(">='&date(vStartDate) & '<=' & date(vEndDate) & '"|"' & '>=' & date(AddYears(vStartDate, -1)) & '<=' & date(AddYears(vEndDate, -1)) & '")'

View solution in original post

2 Replies
sunny_talwar

Try this:

='(">='&date(vStartDate) & '<=' & date(vEndDate) & '"|"' & '>=' & date(AddYears(vStartDate, -1)) & '<=' & date(AddYears(vEndDate, -1)) & '")'

Not applicable
Author

Thank you very much for the quick response!  I was so close.  For the | part I missed the double quotes inside the single.