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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
kylebreit96
Contributor
Contributor

How can I filter by date using variable when loading data from database.

I want to get data from today going back to January 1st of two years ago. Essentially, I want to declare a variable to serve as today's date and then use a sql query to go back to January 1st of two years ago to get the data but not sure how to do this.

Labels (1)
1 Reply
Chanty4u
MVP
MVP

may be this

SQL SELECT *

FROM  xxxxxxx

WHERE MY_YEAR_FIELD > '01-01-2019';

 

or this?

Select DateAdd(year, -2, getdate());