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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Lena_Sofie
Contributor
Contributor

Split row into multiple rows by date

Hello,

my goal is to split machine events at shift and day changes.

I have a list of machine events that are defined by an eventname and a timestamp fort he beginning of the event.

rowIDtimestampeventname
103/04/2020 15:46:13machine working
203/04/2020 16:15:35error
303/04/2020 16:30:22machine working
403/04/2020 23:55:18setup
504/04/2020 03:17:51machine working
604/04/2020 05:02:42setup
704/04/2020 05:31:12machine working
804/04/2020 05:59:59stop for weekend
906/04/2020 06:00:00machine working

 

For analyzing the duration of the events I calculated the time to the next change of events. These are allocated to the event start.

Start:
LOAD
rowid,
"timestamp",
"timestamp"as event_start
FROM [lib://AttachedFiles/Laufzeit.xml]
(XmlSimple, table is [data/slavestate]);

End:
Load
rowid,
event_start,
Peek(event_start, rowid, 'Start') as event_end
resident Start
order By rowid,event_start;

Duration:
Load
rowid,
event_start,
event_end,
(event_end-event_start)*24*60 as event_duration_min
resident End
order By rowid, event_start;

rowIDtimestampeventnameevent_startevent_endevent_duration_min
103/04/2020 15:46:13machine working03/04/2020 15:46:1303/04/2020 16:15:3529
203/04/2020 16:15:35error03/04/2020 16:15:3503/04/2020 16:30:2215
303/04/2020 16:30:22machine working03/04/2020 16:30:2203/04/2020 23:55:18445
403/04/2020 23:55:18setup03/04/2020 23:55:1804/04/2020 03:17:51204
504/04/2020 03:17:51machine working04/04/2020 03:17:5104/04/2020 05:02:42105
604/04/2020 05:02:42setup04/04/2020 05:02:4204/04/2020 05:31:1230
704/04/2020 05:31:12machine working04/04/2020 05:31:1204/04/2020 05:59:5929
804/04/2020 05:59:59stop for weekend04/04/2020 05:59:5906/04/2020 06:00:002880
906/04/2020 06:00:00machine working06/04/2020 06:00:00  

 

shifts: morning 6-14, afternoon 14-22, night 22-6

 

Now I want to do some analysis about the eventduration during a shift/day. Here occurs the problem: Some events last during a shiftchange/midnight and are therefore allocated to the previous shift/day… and distort my analysis.

Qlik question.PNG

How can I split these events to all affected shifts/days?

Help is highly apprechiated!

0 Replies