Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
ymcmb
Contributor III
Contributor III

If statement for a flag for 2 dates

I am trying to create a flag using an if statement but having a hard time getting my expression approved in Qlik. 

Here is what I am trying to accomplish. If a SALE DATE falls under the last 7 days, flag it as 'Last Week', else flag it as 'NA'

if ( SALE_DATE = {">=$(=Date(Today()-7, 'MM/DD/YYYY')) <=$(=Date(today(), 'MM/DD/YYYY'))"}, 'Last Week', 'NA')

Thank you.

Labels (1)
1 Solution

Accepted Solutions
Or
MVP
MVP

It looks like you're mixing up if() and set analysis. Assuming this is in script (which is where you'd typically want to create flags):

if(SALE_DATE >= Today()-7 AND SALE_DATE <= Today(),'Last Week','NA') as My_Flag

View solution in original post

2 Replies
Or
MVP
MVP

It looks like you're mixing up if() and set analysis. Assuming this is in script (which is where you'd typically want to create flags):

if(SALE_DATE >= Today()-7 AND SALE_DATE <= Today(),'Last Week','NA') as My_Flag

ymcmb
Contributor III
Contributor III
Author

Thank you. This was for the script side and absolutely lost it for a second there.