Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
MikeJones
Creator
Creator

Average Time

Hi, I wish to calculate the average time between when a job is created and scheduled.  I am stuck as how I should do this.

Below shows my data and my output so far from Qlik.  The first two jobs were created on 5th June, though they were planned to be undertaken on 6th June. You will see that the average works fine when considering job before 5pm and after 5pm.  However, it doesn't when I look at the whole day.  

MikeJones_2-1688997270486.png

Thanks in advance for your help.

 

 

Labels (3)
1 Solution

Accepted Solutions
Or
MVP
MVP

Typically you would want to convert these two fields to one timestamp field, at which point you can just subtract one from the other. You can do this using Timestamp#(), explicitly convert them as required using date#() and time#() or, if the fields are already recognized as a date and a time, you can just use [PlannedDate] + [Schedule Time].

Note that from a performance perspective, you should consider whether you want this done in the script (which will make the app larger due to the storage of the timestamp) or on the front end (which will keep the app smaller but may impact runtime performance).

View solution in original post

2 Replies
Or
MVP
MVP

Typically you would want to convert these two fields to one timestamp field, at which point you can just subtract one from the other. You can do this using Timestamp#(), explicitly convert them as required using date#() and time#() or, if the fields are already recognized as a date and a time, you can just use [PlannedDate] + [Schedule Time].

Note that from a performance perspective, you should consider whether you want this done in the script (which will make the app larger due to the storage of the timestamp) or on the front end (which will keep the app smaller but may impact runtime performance).

MikeJones
Creator
Creator
Author

Hi Or, thanks for your suggestion.  I went back to the source data and created timestamp data and then subtracted JobScheduled timestamp from JobCreated timestamp.