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: 
hjm35055
Partner - Contributor III
Partner - Contributor III

SQL Rolling 3 years

Hi,

I am working in Qlik Sense and pulling data from a SQL database.  I am trying to limit the SQL script to bring in the last 3 years worth of data based off of the field "oe-date-ent" (not shown).  Anyone know SQL and know what my where clause would be?

Thank you!

Screen Shot 2018-10-23 at 4.33.10 PM.png

1 Reply
achettipalli
Creator
Creator

Assuming your field "oe-date-ent" is a date column.

Let Vdatefilter=date(AddYears(today(),-3),'MM/dd/YYYY')   // you can use max(oe-date-ent) instead of Today() here,                                                                                                       //but you've to load it before the script.

Load

Field1,

field2...

from...

where oe-date-ent  >=$(Vdatefilter);