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: 
fuson
Contributor
Contributor

How to select a work crew from an alternative work schedule

Hello, I am a beginner qlikview and having trouble  selecting a work crew from an alternative work schedule.  Here is the schedule:

  • Monday 6am to 5:59pm = Crew A,  6pm to 5:59am = Crew C
  • Tuesday 6am to 5:59pm = Crew A,  6pm to 5:59am = Crew B
  • Wednesday 6am to 5:59pm = Crew A,  6pm to 5:59am = Crew B
  • Thursday 6am to 5:59pm = Crew A,  6pm to 5:59am = Crew B
  • Friday 6am to 5:59pm = Crew C,  6pm to 5:59am = Crew B
  • Saturday 6am to 5:59pm = Crew C,  6pm to 5:59am = Crew SS
  • Sunday 6am to 5:59pm = Crew SS,  6pm to 5:59am = Crew C

Here's what I have tried:

=If(Match([Day_Name],'Mon'),
           If(Match([SHIFT],2),'A-Crew','C-Crew'),
If(Match([Day_Name],'Tue','Wed','Thu'),
           If(Match([SHIFT],2),'A-Crew','B-Crew'),
If(Match([Day_Name],'Fri'),
           If(Match([SHIFT],2),'C-Crew','B-Crew'),
If(Match([Day_Name],'Sat'),
           If(Match([SHIFT],2),'C-Crew','SS-Crew'),
If(Match([Day_Name],'Sun'),
           If(Match([SHIFT],2),'SS-Crew','C-Crew'))))))

but since the late crew spills into the next day,  the values are wrong.

Any help would be appreciated. ☺

 

 

1 Reply
Anil_Babu_Samineni

Perhaps this?

If(WeekDay(FieldName)='Mon' and Time(FieldName,'hh:mm')>='06:00' and Time(FieldName,'hh:mm')<='17:59', 'Crew A',
If(WeekDay(FieldName)='Mon' and Time(FieldName,'hh:mm')>='18:00' and Time(FieldName,'hh:mm')<='05:59', 'Crew C',
If(WeekDay(FieldName)='Tue' and Time(FieldName,'hh:mm')>='06:00' and Time(FieldName,'hh:mm')<='17:59', 'Crew A',
If(WeekDay(FieldName)='Tue' and Time(FieldName,'hh:mm')>='18:00' and Time(FieldName,'hh:mm')<='05:59', 'Crew B',
If(WeekDay(FieldName)='Wed' and Time(FieldName,'hh:mm')>='06:00' and Time(FieldName,'hh:mm')<='17:59', 'Crew A',
If(WeekDay(FieldName)='Wed' and Time(FieldName,'hh:mm')>='18:00' and Time(FieldName,'hh:mm')<='05:59', 'Crew B',
If(WeekDay(FieldName)='Thu' and Time(FieldName,'hh:mm')>='06:00' and Time(FieldName,'hh:mm')<='17:59', 'Crew A',
If(WeekDay(FieldName)='Thu' and Time(FieldName,'hh:mm')>='18:00' and Time(FieldName,'hh:mm')<='05:59', 'Crew B',
If(WeekDay(FieldName)='Fri' and Time(FieldName,'hh:mm')>='06:00' and Time(FieldName,'hh:mm')<='17:59', 'Crew C',
If(WeekDay(FieldName)='Fri' and Time(FieldName,'hh:mm')>='18:00' and Time(FieldName,'hh:mm')<='05:59', 'Crew B',
If(WeekDay(FieldName)='Sat' and Time(FieldName,'hh:mm')>='06:00' and Time(FieldName,'hh:mm')<='17:59', 'Crew C',
If(WeekDay(FieldName)='Sat' and Time(FieldName,'hh:mm')>='18:00' and Time(FieldName,'hh:mm')<='05:59', 'Crew SS',
If(WeekDay(FieldName)='Sun' and Time(FieldName,'hh:mm')>='06:00' and Time(FieldName,'hh:mm')<='17:59', 'Crew SS,
If(WeekDay(FieldName)='Sun' and Time(FieldName,'hh:mm')>='18:00' and Time(FieldName,'hh:mm')<='05:59', 'Crew C'))))))))))))))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful