Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
tomcatxx
Creator
Creator

Shift worktime(Night 22:00:00 to 06:00)

Hi there. I have a question about night shift. This is the graphic, in which u can see data in period night shift(00:00:00~06:00:00 and 22:00:00~00:00:00). In this graphic(8 hours), 0~6hour reprsent 00:00:00~06:00:00 and 6~8hour represent 22:00:00 ~00:00:00. But all of them is in one day.

But what I want is that 0~2hour is for 22:00:00 ~00:00:00(last day) and 2~8hour is for 00:00:00~06:00:00(today).

Thank you.

Night.PNGStatus.PNG

Script:

-------------------------------------------------------------------------------------------------------------------------------------------------

Data:

Load *,                                                                                // Clock time turn to shift time0~8hour                                                                      
Date(floor(CREATED)) as Datum,
Time(frac(CREATED), 'hh:mm:ss') as Uhrzeit,
if(frac(CREATED)>='06:00:00' and frac(CREATED)<'22:00:00',
if(frac(CREATED)>='14:00:00',frac(CREATED)-14/24,frac(CREATED)-6/24),
if(frac(CREATED)>='22:00:00',frac(CREATED)-16/24,frac(CREATED))) as Schicht_Zeit                    
From
[xx.qvd] (
qvd😞

Ranges:                                                               // Set  Shift Name  with IntervalMatch()
LOAD * INLINE
Start, Stop, Schicht
06:00:00, 13:59:59, Früh
14:00:00, 21:59:59, Spät
22:00:00, 23:59:59, Nacht
00:00:00, 05:59:59, Nacht
]
;

IntervalMatch(Uhrzeit)
Left Join (Ranges)

Load  Start, Stop Resident Ranges;
Drop Fields Start, Stop;

 
left Join(Data)
LOAD *
Resident Ranges;

------------------------------------------------------------------------------------------------------------------------------------------

Let S_Interval_Sekundär = 1;                                             //generate 0~8hours (min.Unit is second)

Schicht_Kalender:
LOAD
Time(frac(Kalender_Uhrzeit)) AS Schicht_Zeit,
;
LOAD Time(Time#((Recno()-1) * $(S_Interval_Sekundär), 's')) AS Kalender_Uhrzeit
AutoGenerate ((8*60*60) / $(S_Interval_Sekundär));

Let S_Interval_Sekundär =;
------------------------------------------------------------------------------------------------------------------------------------------------


0 Replies