Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
sunil-kumar5
Creator II
Creator II

Days Difference

Hi Community,

I need to get days difference from Date2 and Date1. I simply use Date2-Date1 to get days and now the result is showing like -9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9 and goes till -30 and 30.

Can you please advise if I m using the correct procedure and why the data is coming in this format?

 

Thanks

1 Solution

Accepted Solutions
martinpohl
Partner - Master
Partner - Master

maybe use

fabs(Date2-Date1) as Duration

to get the duration, undepending on which date is greater.

Regards

View solution in original post

4 Replies
Kushal_Chawda

If your Date2 is less than the Date 1 then you will get negative values in days.  Probably it could be due to data is wrong. 

martinpohl
Partner - Master
Partner - Master

maybe use

fabs(Date2-Date1) as Duration

to get the duration, undepending on which date is greater.

Regards

Usama
Creator
Creator

Hi,

Script:
Floor(Num(Date1)) as Date1_Upd,
Floor(Num(Date2)) as Date2_Upd,

Front End:
Count ( Date2_Upd  - Date1_Upd)

Thanks,
Usama

From Nothing - To Something - To Everything
sunil-kumar5
Creator II
Creator II
Author

Thanks Martin for your assistance

Fabs fuction gave me the result in decimals so I used fabs(round(Date2-Date1)) and its  working.