Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
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());