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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
DerekTomps
Contributor
Contributor

Timestamp to minutes

Hi, 

This expression currently returns a timestamp. However, I am trying to convert the following script expression in to total number of minutes so I can then divide this by a number of moves as a productivity measure. 

IF(operator_name = PREVIOUS(operator_name) AND type_description = 'UNAV' AND PREVIOUS(type_description) <> 'UNAV' and che_name = previous(che_name)
or operator_name = PREVIOUS(operator_name) AND type_description = 'LGOF' AND PREVIOUS(type_description) <> 'UNAV' and che_name = previous(che_name)
or operator_name = PREVIOUS(operator_name) AND type_description = 'LGON' AND PREVIOUS(type_description) = 'AVAL' and che_name = previous(che_name),
interval(timestamp - PREVIOUS(timestamp)),'hh:mm')&' '& date(date#(left(date(Floor([timestamp])),40),'DD/MM/YYYY')), timestamp(timestamp) AS Loggedin

However, I am drawing a blank and would really appreciate some help. 

Regards

 

Derek

 

1 Reply
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Assuming the field "timestamp" is a proper Qlik datetime -- it appears it is from your example. 

timestamp - Previous(timestamp) 

returns the difference as integer number of days and fractional part of a day.  You have two choices to convert this to  minutes. 

(timestamp - Previous(timestamp))* 1440. // Multiply by #minutes in a day

or 

Num#(Interval(timestamp - Previous(timestamp), 'm')) // Get Interval minutes and convert the text to number

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com