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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Exclude Weekends and Public holidays using one datefield

Good day,

The question I asked earlier on was not so clear. Now I am simplifying it, I have a date field called LeaveDate and it contains Working days from Monday to Friday, Weekends and Holiday. So in my country if a holiday falls on a Sunday, then following day(i.e Monday) will be counted as a holiday. So in my attached spreadsheet, I have highlited the holidays and weekends in Yellow. So what I would like to exclude weekends and public holidays.

          Leave Sample.PNG

  

hope my question is clear.

Thanks

1 Solution

Accepted Solutions
raajaswin
Creator III
Creator III

LET vDatMi = Num(MakeDate(2015,1,1));

LET vDatMa = Num(MakeDate(2017,1,1));

CAL1:

LOAD

Date($(vDatMi) + IterNo()) AS  ALL_DATE

AUTOGENERATE 1

WHILE $(vDatMi)+IterNo() <= $(vDatMa);

HOLIDAY_WEEKEND:

LOAD

if(match(weekday(ALL_DATE),'Sat','Sun'),ALL_DATE) as Holidays

Resident CAL1;

Drop Table CAL1;

Concatenate

PUBLIC_HOLIDAY_LIST:

LOAD Holiday as Holidays

FROM

[Public Holidays.xlsx]

(ooxml, embedded labels, table is Sheet1);

LEAVE:

LOAD LeaveDate as Working_day

FROM

[Leave Data.xlsx]

(ooxml, embedded labels, table is Sheet1) where not Exists(Holidays,LeaveDate);

View solution in original post

22 Replies
sunny_talwar

Exclude them how? Exclude them from loading? Also, do you have this second column which specify the word 'Holiday' or is that something you have to derive from another place?

Not applicable
Author

Hi Sunny,

May be have an indicator created to identify it's a holiday/weekend then I will use the indicator in my expression to exclude them in my calculation.

sunny_talwar

Weekend indicator is easy, how do we know if a certain date is a holiday? I mean 12/16/2016 is a holiday in your country, where do you get that information from?

Not applicable
Author

I actually have Public holiday spreadsheet which has holidays.

PFA

raajaswin
Creator III
Creator III

you can generate a consolidate holiday list then by using where not exist you can remove the holidays

sunny_talwar

I don't see the attachment, can you may be reattach?

Not applicable
Author

SA_Holidays.PNG

sunny_talwar

Since 25th Dec was a Sunday, you get extra holiday on 27th? because 26th was a Holiday also?

raajaswin
Creator III
Creator III

here holiday has been generated form 1/1/2015 to 1/1/2017  and your public holiday is added to that