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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Time Differrence

Good morning all,

I would like to calculate time difference between start_date_time and  end_date_time the duration should be form 'hh:mm:ss' and thereafter I need calculate the total time per CallCentre, Desk, Team_Lead and Agent_Name in a pivot table. I have tried the following expression: =interval( end_date_time - start_date_time, 'hh:mm:ss'), but it bring back blanks. Not sure if I have to calculate it on the script level or expression !Sample Data.PNG

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Make sure your timestamps are really timestamps and not strings. Use the Timestamp# function if necessary (in the script preferably) to turn strings into timestamp values.


talk is cheap, supply exceeds demand

View solution in original post

9 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Make sure your timestamps are really timestamps and not strings. Use the Timestamp# function if necessary (in the script preferably) to turn strings into timestamp values.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

Hi Moses,

Try like below:

In the  Expression:

Time(end_date_time ) - Time (start_date_time)

As @gwassenaar

said make sure that ur timestamp should be in timestanp.

Still if u have any issue then plz try to share some sample data along with output.

i Hope this helps you.

-Nagarjun

vcanale
Partner - Creator II
Partner - Creator II

Hi,

Try:
Interval((Interval(end_date_time, 'hh:mm:ss') - Interval(start_date_time, 'hh:mm:ss')),  'hh:mm:ss')

Not applicable
Author

Thank you, it worked

Not applicable
Author

should I use it as an expression or in script?

Not applicable
Author

Thank you for the assistance

vcanale
Partner - Creator II
Partner - Creator II

Try

In the script:

timestamp(end_date_time,'MM/DD/YYYY hh:mm:ss') as end_date_time,

       timestamp(start_date_time,'MM/DD/YYYY hh:mm:ss') as start_date_time

Expression:

Interval((Interval(end_date_time, 'hh:mm:ss') - Interval(start_date_time, 'hh:mm:ss')),  'hh:mm:ss')

Not applicable
Author

Thank you, I  have tried and it also worked.