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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

select data only from the last 30 days

Dear all

I like to select data only from the last 30 days. It works static, but I like to have this dynamic.

SQL.JPG

Thanks for your help in advance.

3 Replies
petter
Partner - Champion III
Partner - Champion III

Be aware that everything between the SELECT and the following semicolon is interpreted by the SQL source/database. So any logic used in the Where part of the statement would follow the syntax and functions available in the SQL data source.

But you should be able to use $-sign expansion that will be executed before the load script sends the SQL SELECT statement to the source. Maybe like this:

v30DaysAgo = Date( Today(1)-30 , 'YYYYMMDD' );

Select * From ABCD Where abcd >= '$(v30DaysAgo)';

Anonymous
Not applicable
Author

Thanks a lot, it works very well.

petter
Partner - Champion III
Partner - Champion III

Please mark the question as answered and correct