Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Eaun
Contributor III
Contributor III

Calculate between time stamps

This sounded simple to start with I thought just use interval to give me the times but no. On the spreadsheet is the data I'm getting I need to calculate the time between status 4-1 that will give me the up-time and the time between status 1-4 will give the time stopped and the time between 2-4 will give the time in manual mode.
I've tried the above function but with no luck what would be the best way to do this or do i pass it back has its not possible with data in the format it is in ?

1 Solution

Accepted Solutions
sunny_talwar

Are you looking to get 8 minutes and 23 seconds on the row where Machine PK is 433?

image.png

Aggr(
	Interval(Only({<InAuto = {'True'}>} [Machine Time]) - Above(Only({<InAuto = {'True'}>} [Machine Time])), 'hh:mm:ss')
, [Machine PK])

 

View solution in original post

5 Replies
sunny_talwar

Are you looking to do this on the front end or back end of the app? If you tried above() in the back end, it wouldn't work because Above() is only available on the front end of the app (in a chart).

Also, if you did try it in a chart, what were your dimensions? What was your expression?

Eaun
Contributor III
Contributor III
Author

Looking at this from the front end I've tried this :

Sum({<InAuto={'True'}>}Aggr(Interval([Machine Time]-Above(total[Machine Time],1),'hh:mm:ss'),[Machine PK]))

its the same as looking status 4 but its wrong because it will only calculate between status 4 and status 4 does that make sense ?

 

Will attach  the app Can not get the qvd to attach 

sunny_talwar

Are you looking to get 8 minutes and 23 seconds on the row where Machine PK is 433?

image.png

Aggr(
	Interval(Only({<InAuto = {'True'}>} [Machine Time]) - Above(Only({<InAuto = {'True'}>} [Machine Time])), 'hh:mm:ss')
, [Machine PK])

 

Eaun
Contributor III
Contributor III
Author

Thank you that looks correct will try it and report back : )

Eaun
Contributor III
Contributor III
Author

Made a little change 

 

Sum(Aggr( Interval(Only({<Status_code = {1}>} [Machine Time]) - Above(Only({<Status_code = {4}>} [Machine Time])), 'hh:mm:ss') , [Machine PK]))

and then changed the status codes to get the difference times with each status