Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
qliklearnervir
Creator
Creator

how to define where clause for date

Hi,

I want to filter my LOad process with date.

where createddate = 45678.7685   like that/...

vToday=Date(Today(),'YYYYMMDD');

Load Statment :

LOAD Booking,

           Booking Number

FROM $(vQvdlaction)Booking.qvd(qvd)

where Date(createddate,'YYYYMMDD')= $(vToday());

but i am getting 0 outcome...

but in data there are 50 rows with createddate =today()...

PLEASE SUGGEST THE WAY TO CONVERT TIME IN WHERE CONDITION TO LOAD DESIRED OUTCOME.

5 Replies
prma7799
Master III
Master III

Your script looks like good

Please try like below

where Date(createddate,'YYYYMMDD')  =  date(Today(),'YYYYMMDD');

Or post some sample data.

balabhaskarqlik

may be:

vToday=Date(floor(Today()),'YYYYMMDD');

or

vToday=Date(floor(Today()),'YYYY-MM-DD');

Statement:

LOAD Booking,

           Booking Number

FROM $(vQvdlaction)Booking.qvd(qvd)

where Date(floor(createddate),'YYYYMMDD')= $(vToday());

//where Date(floor(createddate),'YYYY-MM-DD')= $(vToday());

Anil_Babu_Samineni

You may mis understand the logic over here

Date(45678.7685) Returns 01/21/2025

Date(Today()) Returns Today's date of your machine.

Is that your machine showing same date like 01/21/2025 for you? If so, This condition true nor false

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
kamal_sanguri
Specialist
Specialist

the same way you define for other values. You just have to make sure the format of values in field at the left side matches with the format at right side.

For Ex:

Due Date = 1-Jan-2017

Where

DueDate < '2-Jan-2017'

If they are in different format you can convert them using Date or Date# function.

kamal_sanguri
Specialist
Specialist

Try this way:

Just use today() instead of variable in Where clause.

Refer attached QV document.

Data:

LOAD createddate

Where newdate = Today();

LOAD createddate,

Date(round(createddate),'YYYYMMDD') as newdate;

LOAD *

Inline

[

createddate

42921.7825

45678.7685

45678.7686

];