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

Announcements
AWS Degraded - You may experience Community slowness, timeouts, or trouble accessing: LATEST HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum difference between two dates

Hi,

I have two date fields that I need to do a diff on. What I simply do right now is date1 - date2 and format the column as "interval". If I want to sum all the differences I don't get the correct numbers (the diff gives me data such as 0.1239839498). Please help!

Thanks

Shilpa

6 Replies
Not applicable
Author

It sounds like your dates are in a timestamp format. Try adding Date(DateField,'MM/DD/YYYY') to adjust your formatting.

Not applicable
Author

Well, I do need the time stamp format since I am counting the difference in hours and also minutes.

Not applicable
Author

Just adjust the format. For example:

Interval(Timestamp(activity_totime,'MM/DD/YYYY HH:MM')-Timestamp(activity_fromtime,'MM/DD/YYYY HH:MM'))

Then set Chart Properties > Number > Interval

Not applicable
Author

Thanks! I am already able to get the difference. However, now I want to sum it up. And when I call "=sum("Time_taken") - it gives me some wierd numbers. I want to be able to sum up all the intervals to get the total time taken

MayilVahanan

Hi

Try like this

=Sum(total [Time Taken])

Hope that helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Thanks! That seems to be working., However, looks like I need to do the sum on latest data only - so I need a aggr(max(start_time), test_id) - something like that. I will try that out. Thanks for your help!