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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculating downtime

Hi I trying to calculate the downtime of a machine. But I need some help.

My data looks like this:

    

PTG16TIMEPTG16StatusRunStatusERR_NR
14-10-2015 09:12START1235232
14-10-2015 09:31CALLSTART1235232
14-10-2015 09:43CALLEND1235232
14-10-2015 09:49CALLSTART1235237
14-10-2015 09:54STOP0235237
14-10-2015 10:12START1235237
14-10-2015 10:13STOP0235237
14-10-2015 10:35START1235237
14-10-2015 10:38STOP0235237
14-10-2015 10:40START1235237
14-10-2015 10:41CALLEND1235237
15-10-2015 08:49STOP0235541
15-10-2015 08:59CALLSTART0235541
15-10-2015 11:05CALLEND0235541
15-10-2015 12:20START1235573
15-10-2015 12:20CALLSTART1235573
15-10-2015 12:30STOP0235573
15-10-2015 12:31START1235573
15-10-2015 12:35CALLEND1235573
16-10-2015 09:22STOP0235874
16-10-2015 09:31CALLSTART0235874
16-10-2015 10:22CALLEND0235874

Here is an example of what i need (Err: 235573)

Operator calls technician at 15-10-2015 08:59 the machine is still running  (Started 15-10-2015 12:20)

The machine stops at 15-10-2015 12:30 and is started again at 15-10-2015 12:31

The technician leaves at 15-10-2015 12:35

Between Callstart and Callend there are 15 minutes but running for 14 minutes. So the outcome should be 1 minute.

How to do this  ? I'm lost...

/Rasmus

4 Replies
sunny_talwar

Do you min 4 minutes? instead of 1 min?

Capture.PNG

MarcoWedel

Hi,

one solution might be:

QlikCommunity_Thread_236091_Pic1.JPG

QlikCommunity_Thread_236091_Pic2.JPG

QlikCommunity_Thread_236091_Pic3.JPG

tabErrs:

LOAD RecNo() as ID,

    Timestamp#(PTG16TIME,'DD-MM-YYYY hh:mm') as PTG16TIME,

    PTG16Status,

    RunStatus,

    ERR_NR

FROM [https://community.qlik.com/thread/236091] (html, codepage is 1252, embedded labels, table is @1);

Left Join (tabErrs)

LOAD ID,

    If(ERR_NR=Previous(ERR_NR),Interval(Previous(PTG16TIME)-PTG16TIME,'hh:mm')) as Duration

Resident tabErrs

Order By ERR_NR, PTG16TIME desc, ID desc;

hope this helps

regards

Marco

Not applicable
Author

No

CALLSTART: 15-10-2015 12:20

CALLEND: 15-10-2015 12:35

That is 15 minutes

Within the "CALL" time the machine has been running some of the time:

START:   Sometime before CALLSTART -> Therefor Time is set to CALLSTART (15-10-2015 12:20)

STOP:     15-10-2015 12:30

and

START:     15-10-2015 12:31

STOP:      Sometime after CALLEND -> Therefor time is set to CALLEND (15-10-2015 12:35)

This gives:

15 minutes - (10 min + 4 min) = 1 minute downtime (CALLTIME) where the machine has not been running.

Hope that makes sense...

MarcoWedel

like this:

QlikCommunity_Thread_236091_Pic4.JPG

QlikCommunity_Thread_236091_Pic5.JPG

hope this helps

regards

Marco