Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
haydenfontana
Contributor II
Contributor II

Trying to use set analysis with a date range that is relative to today

Hey All,

I am trying to create an expression that will only show values that are within a certain range of dates. I am having trouble making it a relative function that only shows values that range from two months from today, say 5/9/2022, and all dates before then.

Below is the equation I have been working with. It is not representative of all the attempts I've had, however I believe it best represents the concept that I am trying to achieve.

haydenfontana_0-1657383366347.png

 

Labels (1)
1 Solution

Accepted Solutions
haydenfontana
Contributor II
Contributor II
Author

Thank you for your help. I finally found a solution using parts from both of the answers above. The main problem was that the date format for my field included specific hour and minute time stamps. So I was able to get a new field created and also simplified it to be an open ended range.

haydenfontana_0-1658408418008.png

 

View solution in original post

5 Replies
BrunPierre
Partner - Master
Partner - Master

@haydenfontana Create a Start Date and End Date variable, and insert the below in your expression;

DateField= {">= $(StartDate) <= $(EndDate)"}

Cheers!

 

MayilVahanan

HI 

Try like below

ScheduledShipDate = {">$(=Date(Today()-61,'YourDateFormat'))<=$(=Date(Today(),'YourDateFormat'))"}

Both exp results always last 60 days info.

If its dynamic, instead of Today, try with Max(ScheduledShipDate) and ignore all time filters like Year=, Month=

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
haydenfontana
Contributor II
Contributor II
Author

Hey Peter,

Thank you for the advice, however when inputting this into my expression, I end up with no results on my table. I am not sure if I did it right however here is the equation I came up with.

haydenfontana_0-1657914993105.png

 

BrunPierre
Partner - Master
Partner - Master

@haydenfontana Try this and ignore all the time dimensions as @MayilVahanan  rightly pointed out.

ScheduledShipDate={"$(='>=' & AddMonths(monthstart (max(ScheduledShipDate)),-2)&'<=' & Date(Max(ScheduledShipDate)))"}

haydenfontana
Contributor II
Contributor II
Author

Thank you for your help. I finally found a solution using parts from both of the answers above. The main problem was that the date format for my field included specific hour and minute time stamps. So I was able to get a new field created and also simplified it to be an open ended range.

haydenfontana_0-1658408418008.png