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: 
Anonymous
Not applicable

IF statements in load with Weekday

Hi - thanks in advance for any replies.

I use the following as part of a load script to recognise trading hours

(OOH is out of hours, INH is in hours)

I need the load to populate [DayShift] based on the following:

INH which is 8am-9pm Mon-Fri and 9am-5pm on Saturday. Any hours outside of this are OOH.



This is the load code I have tried but it does not load any INH, everything OOH - any ideas?

if(Weekday(DateLeadReceived) = 'Sat' AND time(timestamp(DateLeadReceived, 'YYYY-MM-DD hh:mm:ss.fff')) >= '09:00:00' AND time(timestamp(DateLeadReceived, 'YYYY-MM-DD hh:mm:ss.fff')) <= '17:00:00','INH',

(if((Weekday(DateLeadReceived) <> 'Sun' OR Weekday(DateLeadReceived) <> 'Sat') AND time(timestamp(DateLeadReceived, 'YYYY-MM-DD hh:mm:ss.fff')) >= '08:00:00' AND time(timestamp(DateLeadReceived, 'YYYY-MM-DD hh:mm:ss.fff')) <= '21:00:00','INH','OOH'))) as [DayShift],



2 Replies
Anonymous
Not applicable
Author

I had a similar requirement and I resolved it using the IntervalMatch function. Please have a look at this useful function.

Regards,

Dinesh.

Anonymous
Not applicable
Author

Thanks Dinesh

I have had a look at IntervalMatch but can't currently find anything that achieves what I would need

Could you post any code?