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: 
ajsjoshua
Specialist
Specialist

Breakdown time

Hi all,

I want to calculate the breakdown time

ex:the breakdown time for machine 1 is 10 min

MachineNumberStartStop
107:3008:00
108:1008:50
208:3008:40
209:1509:40
309:4710:23
310:3511:05
311:2211:52
1 Solution

Accepted Solutions
sunny_talwar

May be this:

Table:

LOAD * INLINE [

    MachineNumber, Start, Stop, Program, Breakdowntime

    1, 07:30, 08:00, Lower Arm, 00:10:00

    1, 08:10, 08:50, Lower Arm, 00:25:00

    1, 08:30, 08:40, DETECT STOP, 00:00:00

    1, 09:15, 09:40, Lower Arm, 00:07:00

    1, 09:47, 10:23, Lower Arm, 00:00:00

];

Left Join (Table)

LOAD MachineNumber,

  Start,

  Stop,

  Interval(If(MachineNumber = Previous(MachineNumber),  Peek('Start') - Stop)) as Breakdowntime_Calculated

Resident Table

Where Program <> 'DETECT STOP'

Order By MachineNumber, Start desc;


Capture.PNG

View solution in original post

13 Replies
m_woolf
Master II
Master II

in script:

Stop - Start as BDTime;

the sum(BDTime) for each machine

ajsjoshua
Specialist
Specialist
Author

Hi,

It should be like this

second one start -first one stop

  

MachineNumberStartStopResult
107:3008:00 -
108:1008:5000:10:00
108:5509:1000:05:00
109:1509:4000:00:00
sunny_talwar

Not sure I understand the logic behind deriving the Result field. Would you be able to walk us through with the calculation there?

ajsjoshua
Specialist
Specialist
Author

Hi Sunny,

I want to find the

machine breakdown time

You can see the machine started at 07:30 and stopped at 08:00 and resumed at 08:10 so the breakdown time is 10 min.

  

MachineNumberStartStop Breakdowntime
107:3008:00          00:10:00
108:1008:5000:10:00
108:5509:1000:05:00
109:1509:4000:00:00
crusader_
Partner - Specialist
Partner - Specialist

Hi,

Try this

LOAD *

     , if(MachineNumber=previous(MachineNumber), Start - previous(Stop)) as Breakdowntime

;

[Your load statement]

HTH

Andrei

Peter_Cammaert
Partner - Champion III
Partner - Champion III

And first make sure that your source table is ordered by MachineNumber and ascending Start time.

Best,

Peter

Not applicable

TimeStamp#(Coulmn1-Coulmn2, 'DD-MM-YYYY hh:mm:ss')  as ResultDateTime

crusader_
Partner - Specialist
Partner - Specialist

Exactly

ajsjoshua
Specialist
Specialist
Author

Hi Andrei ,

Its working for all values but in somecase its not working

  

  

MachineNumberStartStopProgramBreakdowntime
107:3008:00Lower Arm00:10:00
108:1008:50Lower Arm00:25:00
108:3008:40DETECT STOP00:00:00
109:1509:40Lower Arm00:07:00
109:4710:23Lower Arm00:00:00

IF DETECT STOP comes it should not consider it.

Regards,

Joshua.