Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Date Condition

Hello dear community,

Can someone help me to create a condition about the date where date = Today -29days

11 Replies
formosasol
Partner - Contributor III
Partner - Contributor III

try the following

(Date(Today(Data)-29,'DD/MM/YYYY')) as PastDate

Todays Date -29 Days.bmp

jaimeaguilar
Partner - Specialist II
Partner - Specialist II

Hi,

The answer given by Enrique is right. However, you seem to be using an ODBC connection for Excel. It would be easier if you use the native connector provided by Qlik. Otherwise, you'll need to understand how SQL code and Qlik Code work when used together.

In your case, the first part is SQL code because you're using the ODBC connector for Excel:

ExcelTable:

SQL Select *

FROM `C:\Users\etc\quantities.xls`.`Sheet1$`;


So you CANNOT use this --> Date>Date(today()-29,'DD/MM/YYYY') at least not directly, you'll need to store Date(today()-29,'DD/MM/YYYY') in a variable like it has been already suggested AND MATCH YOUR ORIGINAL DATE FIELD FORMAT ( DD/MM/YYYY, YYYY/MM/DD, MM/DD/YYYY or whatever it is).


Another approach to solve this, would be to combine qlik and SQL code like this:

ExcelTable:

LOAD *

WHERE date(Date) > Date(today()-29,'DD/MM/YYYY');

SQL Select *

FROM `C:\Users\etc\quantities.xls`.`Sheet1$`;


Everything between the LOAD and the first semicolon (;) is considered Qlik Code. Then, everything after SQL keyword will be considered SQL Code. The way this block of code works is that first the SQL  part  executes and then the Qlik part executes, taking the SQL table as input.  In Qlik Language this is called Preceding Load.


I think you may need to get familiar with how Qlik works before fully understanding all this, but I hope this helps,


regards