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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date issues while loading

Hello,

I've a datetime format field in my qvd file i.e CaptureDateTime. It's data looks like

CaptureDateTime

2011-08-28 22:33:55.3333

2011-08-27 23:13:45.3333

2011-08-26 14:33:55.3333

.

.

.

.

......Soon

Now i'm catching max of this date and storing in variable with help of peek function.

So i'm written code like this:

Load

     CaptureDateTime

From

table.qvd

Where CaptureDateTime > Date('vMaxDate' - $(vDays),'DD/MM/YYYY');

i.e vDays value is 7

so when i load above script i should get the dates of CaptureDateTime from 2011-08-22 to 2011-08-28 only but i'm getting the o/p from 21 to 28 date.

How can i overcome this...

8 Replies
Sokkorn
Master
Master

Hi jacq,

Try this

Where CaptureDateTime > Date('vMaxDate' - $(vDays),'DD/MM/YYYY')+1;

Regards,

Sokkorn Cheav

Not applicable
Author

ya i tried this previosly i'm getting exact result but how it is possible to get the exact result. We are keeping where condition like greater than 21 date it should come from 22. But if we keep greater than 22 then the result is from 22 to 28.

i tried this also it is working but how it is possible can you explain me on this clearly.

Where CaptureDateTime > Date('vMaxDate' - ($(vDays)-1),'DD/MM/YYYY');

rohit214
Creator III
Creator III

hi

Jacq

try this

Where CaptureDateTime > Date('vMaxDate' - $(vDays)+1,'DD/MM/YYYY');

or

Where CaptureDateTime > Date(addmonths(('vMaxDate' - $(vDays)+1,'DD/MM/YYYY');

may it helps you

thanks

rohit

Not applicable
Author

Rohit

My problem is not with adding $(vDays)+1.

See if i written the script in the below format i'm getting exact result what i want i.e from 22 to 28th date.

Where CaptureDateTime >'21/08/2011'

But if i use below script i'm not able to get the result what i want.

Where CaptureDateTime > Date('vMaxDate' - $(vDays),'DD/MM/YYYY');

the script is nothing but it says like this first it gets the max of date and stores in one variable vMaxDate from this i'm substracting with 7 through the variable vDays then the result will be 21-08-2011. From here i'm loading the data which are greater than this date.

for your reference i'm attching my qvw file.


perumal_41
Partner - Specialist II
Partner - Specialist II

Hi

i Uploaded  one file . First reload  after check it .

Regards

Perumal.A

Not applicable
Author

Perumal

You also doing same thing. I want reason why we need to add one there. B'coz everytime vDays value will be changed.

rohit214
Creator III
Creator III

hi try this one

Where CaptureDateTime > Date(('vMaxDate' - $(vDays))+1,'DD/MM/YYYY');

or

Where CaptureDateTime > Date(addmonths(('vMaxDate' - $(vDays))+1,'DD/MM/YYYY');

please let me know

it is working or not

thanks

rohit

Not applicable
Author

Rohit

It is giving the result. But my question is why we need to add one again there.