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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
pascaldijkshoor
Creator
Creator

Date filter in the load editor

Hello,

I want to add a date filter for loading data in the load editor. I have tried several where clauses but all didn't work.

The column name is SHIPMENT_DATE and the date format is for example: 1/23/2016 12:00:00 AM

I want to include only the data from 2017 and 2018, could someone help me with this?

Thank you in advance,

Pascal

11 Replies
Anil_Babu_Samineni

You can define

Load * From Table Where SHIPMENT_DATE >= 'Your Date Format' and SHIPMENT_DATE <= 'Your Date needed';

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
buzzy996
Master II
Master II

try this way as well,

WHERE SHIPMENT_DATE >='2017/01/01 00:00:00'; (check ur date data format if u have any issue)

pascaldijkshoor
Creator
Creator
Author

Thanks for the reply, but both solutions do not work.

tamilarasu
Champion
Champion

Hi Pascal,

Try something like,

Data:

Load *

From

Table

Where Year(SHIPMENT_DATE ) >= 2017;

If the above script is not working then SHIPMENT_DATE field should be in text format in your source table. In that case you can try,

Data:

Load *

From

Table

Where Year(Date#(SHIPMENT_DATE,'M/DD/YYYY hh:mm:ss TT'))  >= 2017;


tamilarasu
Champion
Champion

If you looking for dynamic script, you can try

Let vYear = Year(Addyears(Today(),-1));

Data:

Load *

From

Table

Where Year(SHIPMENT_DATE ) >= $(vYear);

pascaldijkshoor
Creator
Creator
Author

I have tried this one, but I get an error that says: "YEAR": invalid identifier

tamilarasu
Champion
Champion

Looks like you are fetching data from Oracle. If thst is the case, you can try,

Data:

SQL SELECT *

From

Table

Where Extract( Year From SHIPMENT_DATE ) >= 2017;

alis2063
Creator III
Creator III

If your are loading data before preceding load as in Sql Source then use Cast fund as below.

Data:

SQL SELECT *

From

Table

where Cast(SHIPMENT_DATE as date) between '01-Jan-2017' and '05-Jan-2018'

isingh30
Specialist
Specialist

Why are you doing this in the main script when you can do this in the table properties. What table are you using? Please specify the format in the number tab.

Basic Date Format - date#(date,'DD.MM.YYYY')

Thanks.