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: 
lbunnell
Creator
Creator

Date field vs date variable comparison

I'm trying to make a comparison evaluation between a date variable  and a date stored in a table. I've tried several methods based on community posts, but can't seem to get this to work. The date is stored in the table in the format MM/DD/YYYY. 

SET vLast30 = today()-30;

NoConcatenate
Table1:
Load *,
if(OPN_DT>date('$(vLast30)','MM/DD/YYYY'),'Yes','No') as [Too New]
Resident Extract;

 

I tried setting the variable like date((today()-30)),'MM/DD/YYYY') and tried several variations of num# with date functions but the comparison isn't made after the file loads and the $(vLast30) variable shows 43571 after load.

Labels (1)
1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Try without the quotes and date mangling:

if(OPN_DT > $(vLast30), 'Yes', 'No') as [Too New]

 

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

2 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Try without the quotes and date mangling:

if(OPN_DT > $(vLast30), 'Yes', 'No') as [Too New]

 

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
lbunnell
Creator
Creator
Author

It's always easier than I try to make it out to be -lol. Thanks!