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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Finding the difference between timestamps

I have data that corresponds to several groups of field technicians and the time that they start and complete each job during the day.   This timestamp information comes across as HH:MM:SS

I am looking for the when a tech starts his FIRST job of the day and when he completes his LAST job of the day.  I have been able to find the particular timestamps for this information by using Maxstring and Minstring to display this information.

My question revolves around finding the difference between these two values.   IE, a tech starts at 8am and finishes at 1:30pm so therefore he worked 5.5 hours.

Any help would be appreciated.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You should let QV interprete your timestamps as such, resulting in values having a numerical part.

To achieve this, use the time interpretion function time#(), like

LOAD

time#(TIMEFIELD, 'hh:mm:ss') as TIMEFIELD,

...

from YourTable;

If QV has interpreted your values correctly, you can then use interval() function to get the difference in time:

=interval(ENDTIMEFIELD-STARTTIMEFIELD)

or

=interval( max(TIMEFIELD) - min(TIMEFIELD) )

Hope this helps,

Stefan

View solution in original post

3 Replies
swuehl
MVP
MVP

You should let QV interprete your timestamps as such, resulting in values having a numerical part.

To achieve this, use the time interpretion function time#(), like

LOAD

time#(TIMEFIELD, 'hh:mm:ss') as TIMEFIELD,

...

from YourTable;

If QV has interpreted your values correctly, you can then use interval() function to get the difference in time:

=interval(ENDTIMEFIELD-STARTTIMEFIELD)

or

=interval( max(TIMEFIELD) - min(TIMEFIELD) )

Hope this helps,

Stefan

Not applicable
Author

Thank you, that works perfectly.

I found that i could also do the same thing by changing the data type directly using the number tab in my chart properties.

I really appreciate the quick response.

Not applicable
Author

Thank you, that works perfectly.

I found that i could also do the same thing by changing the data type directly using the number tab in my chart properties.

I really appreciate the quick response.