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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
rakeshkumar1890
Creator
Creator

Calculate difference between two Date and Time

Hi guys,

I am facing a challenge to calculate how many average days and time are taken by user to complete the task.

right now I am using this calculation but can't correct output on averaging this

This calculation is without averaging

(date([Closing Date])-date([Creation Date]))&':'&time([Closing Time]-[Creation Time])

MonthTicket NoCreation DateClosing DateCreation TimeClosing Time

Avg Time Taken By User

(Days:Hours:Minute:Second)

Feb5004315143151-53322.4896875-53322.32767222200:03:53:18
Feb5014315143151-53322.4224537037-53322.26589533600:03:45:26
Feb5024315143152-53322.342650463-53322.45527600701:21:17:49

if Collapse by month then what will be the Avg Time Taken by user?

after that I was used this calculation

interval(avg((date([Closing Date])-date([Creation Date]))),'DD') &': '&Interval(Avg(time([Closing Time]-[Creation Time])),'hh:mm:ss')

but get incorrect output on third case

MonthTicket NoCreation DateClosing DateCreation TimeClosing Time

Avg Time Taken By User

(Days:Hours:Minute:Second)

Feb5004315143151-53322.4896875-53322.32767222200:03:53:18
Feb5014315143151-53322.4224537037-53322.26589533600:03:45:26
Feb5024315143152-53322.342650463-53322.45527600701: -02:42:10
Labels (1)
1 Solution

Accepted Solutions
rakeshkumar1890
Creator
Creator
Author

Now I'm going to close this thread

I have the solution which I was required

On Script level

Timestamp#(date([Creation Date])&' '&time([Creation Time]),'DD-MM-YYYY hh:mm:ss')  as [Creation TimeStamp],

Timestamp#(date([Closing Date])&' '&time([Closing Time]),'DD-MM-YYYY hh:mm:ss') as [Closing TimeStamp],

after that on Expression

Interval(avg(([Closing TimeStamp]-[Creation TimeStamp])),'DD:hh:mm:ss')

Thanks

View solution in original post

1 Reply
rakeshkumar1890
Creator
Creator
Author

Now I'm going to close this thread

I have the solution which I was required

On Script level

Timestamp#(date([Creation Date])&' '&time([Creation Time]),'DD-MM-YYYY hh:mm:ss')  as [Creation TimeStamp],

Timestamp#(date([Closing Date])&' '&time([Closing Time]),'DD-MM-YYYY hh:mm:ss') as [Closing TimeStamp],

after that on Expression

Interval(avg(([Closing TimeStamp]-[Creation TimeStamp])),'DD:hh:mm:ss')

Thanks