Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Sxbbb
Creator III
Creator III

I need shift field = Morning Afternoon Night

I have Field 

Sxbbb_0-1724836892978.png

 

Morning shift time 06.00-13.59 hrs. Afternoon shift 14.00-21.59 hrs. Night shift 22.00-05.59 hrs. I need shift field = Morning Afternoon Night I want to bring time TimeStartDowntime to TimeFinishDowntime is divided into shifts.

EX

StartDowntime ='11:42:40' to FinishDowntime ='23:03:38'
The shifts are morning, afternoon, and night.

I need a field that displays values ​​like this.

Sxbbb_1-1724836937567.png

 

4 Replies
BrunPierre
Partner - Master
Partner - Master

Try this.

If(TimeStartDowntime >= PurgeChar(MakeTime(06,00,00),'AMP') and TimeFinishDowntime <= PurgeChar(MakeTime(13,59,59),'AMP'), 'Morning',
If(TimeStartDowntime >= PurgeChar(MakeTime(14,00,00),'AMP') and TimeFinishDowntime <= PurgeChar(MakeTime(21,59,59),'AMP'), 'Afternoon',
If(TimeStartDowntime >= PurgeChar(MakeTime(22,00,00),'AMP') and TimeFinishDowntime <= PurgeChar(MakeTime(05,59,59),'AMP'), 'Night' ))) as Shift

Sxbbb
Creator III
Creator III
Author

No. Is there another way?

Sxbbb_0-1724896930089.pngSxbbb_1-1724896949182.png

 

BrunPierre
Partner - Master
Partner - Master

Could you share a sample of the data?

Sxbbb
Creator III
Creator III
Author

Sxbbb_0-1724987396840.png