Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

markgraham123
Valued Contributor

Diff. between dates is giving decimal value.

Hi all,

I have ID, Field1 (Date1) and Field2 (Date2).

When i try to do Field2-Field1, the result is in decimals.

I was wondering why, as i never faced this issue and the fields were in Date format but not Timestamp.

Can someone help. Pls find attachment.

Tags (1)
1 Solution

Accepted Solutions

Re: Diff. between dates is giving decimal value.

Also Date() just formats it, you need the floor() to remove the timestamp decimals.

8 Replies

Re: Diff. between dates is giving decimal value.

Your fields are timestamps, so you need to floor() them by using an expression like this :

     floor(Field2)-floor(Field1)

Employee
Employee

Re: Diff. between dates is giving decimal value.

Your Field1 is a timestamp formatted as date, please check your excel file

Capturar.PNG

markgraham123
Valued Contributor

Re: Diff. between dates is giving decimal value.

Yes sir. But i have converted it to Date using Date(Filed1) and Date(Filed2) function.

markgraham123
Valued Contributor

Re: Diff. between dates is giving decimal value.

Is it because the timestamp still present?

Re: Diff. between dates is giving decimal value.

Not in the load script of the qvw you posted :

Directory;

LOAD ID,

     Field1,

     Field2

FROM

tets.xlsx

(ooxml, embedded labels, table is Sheet1);

Re: Diff. between dates is giving decimal value.

Also Date() just formats it, you need the floor() to remove the timestamp decimals.

markgraham123
Valued Contributor

Re: Diff. between dates is giving decimal value.

I got it now.

Thanq Bill

Employee
Employee

Re: Diff. between dates is giving decimal value.

Date() does not convert, only formats

Date(Floor()) does what you need