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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
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

 

Labels (4)
5 Replies
BrunPierre
Partner - Master II
Partner - Master II

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 II
Partner - Master II

Could you share a sample of the data?

Sxbbb
Creator III
Creator III
Author

Sxbbb_0-1724987396840.png

 

BrunPierre
Partner - Master II
Partner - Master II

Retry with this.

If((Time(TimeStartDowntime) >= Time('06:00:00') and Time(TimeStartDowntime) <= Time('13:59:59')), 'Morning',
If((Time(TimeStartDowntime) >= Time('14:00:00') and Time(TimeStartDowntime) <= Time('21:59:59')),'Afternoon',
If((Time(TimeStartDowntime) >= Time('22:00:00') and Time(TimeStartDowntime) <= Time('23:59:59')) or (Time(TimeStartDowntime) >= Time('00:00:00') and Time(TimeStartDowntime) <= Time('05:59:59')),'Night'))) as CheckPart_Shift