Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
markgraham123
Specialist
Specialist

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.

1 Solution

Accepted Solutions
Anonymous
Not applicable

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

View solution in original post

8 Replies
Anonymous
Not applicable

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

     floor(Field2)-floor(Field1)

Clever_Anjos
Employee
Employee

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

Capturar.PNG

markgraham123
Specialist
Specialist
Author

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

markgraham123
Specialist
Specialist
Author

Is it because the timestamp still present?

Anonymous
Not applicable

Not in the load script of the qvw you posted :

Directory;

LOAD ID,

     Field1,

     Field2

FROM

tets.xlsx

(ooxml, embedded labels, table is Sheet1);

Anonymous
Not applicable

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

markgraham123
Specialist
Specialist
Author

I got it now.

Thanq Bill

Clever_Anjos
Employee
Employee

Date() does not convert, only formats

Date(Floor()) does what you need