Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

deepanshu_chamo1
New Contributor

Exclude the Future Date

Hello All

Kindly help me in the below query for Qlik Sense:

I have dates ranges from 2014-02-01 00:00:00 to 2017-12-31 00:00:00 which includes the future dates as well.

I want to include the filter in LOAD statement which includes the dates from 2014-02-01 00:00:00 till today's date.


I try to write the code in SQL as:


where DATE(FLOOR(Active_date), 'YYYY-MM-DD') <= DATE(FLOOR(TODAY(), 'YYYY-MM-DD')


But it gives the error.


Please help to correct the formula.

Regards

Deepanshu

Tags (1)
2 Replies
MVP
MVP

Re: Exclude the Future Date

Can you post your complete LOAD statement and post the error message you get?

In general, correctly interprete your date fields:

Why don’t my dates work?

Get the Dates Right

Then you should be able to limit the date range in a WHERE clause:

LOAD ...

FROM ...

WHERE Active_date <= Today(1);

or create a flag in your master calendar:

LOAD

     Date,

     If(Date <= Today(1), 1,0) AS ToDateFlag,

     ...

The Master Calendar

MVP
MVP

Re: Exclude the Future Date

It seems that you are putting this WHERE statement in the SQL statement. Which I think is the right thing to do because you will only bring those rows which are needed from the database. But the issue here is that QlikView's syntax won't work in your SQL statement because the execution is sent over to the database. So in order to make this WHERE statement to work, you would need a statement which you would use when you run it outside QlikView (for example in TOAD).