Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
anriretief
Contributor III
Contributor III

Last Working Day Of A Week

Is there a way to get the last working date in a specific week (where holidays should be excluded from the working days)?

So for example 

Suppose Friday 2020/06/26 is the last day of the week but it is a public holiday. Then I want to obtain the date of the Thursday (which in this case would be 2020/06/25)

I know how to get the last working day of a month, but I am unsure how one would get it for a specific week.

Any help would be greatly appreciated 

1 Solution

Accepted Solutions
Anonymous
Not applicable

I don't know your startdate, but maybe 
firstworkkdate would do what you want
first parameter is your date (should be required weekend)
second parameter is number of workdays needed, which must be 1! you need 1 day to complete work
third parameter is list of your public holidays ('19.06.2020')
solution might be: firstworkdate('20.06.2020',1,'19.06.2020') results in 18.06.2020

if you only have a date within the week you just expand with the weekend function
firstworkdate(weekend('15.06.2020',)1,'19.06.2020') results in 18.06.2020
both assuming that friday 18th june is a public holiday (which in reality is not)

explanation: firstworkdate defines when you should start work so it will be completed in specified number of workdays!

does it helps or gives you an idea?

View solution in original post

2 Replies
Anonymous
Not applicable

I don't know your startdate, but maybe 
firstworkkdate would do what you want
first parameter is your date (should be required weekend)
second parameter is number of workdays needed, which must be 1! you need 1 day to complete work
third parameter is list of your public holidays ('19.06.2020')
solution might be: firstworkdate('20.06.2020',1,'19.06.2020') results in 18.06.2020

if you only have a date within the week you just expand with the weekend function
firstworkdate(weekend('15.06.2020',)1,'19.06.2020') results in 18.06.2020
both assuming that friday 18th june is a public holiday (which in reality is not)

explanation: firstworkdate defines when you should start work so it will be completed in specified number of workdays!

does it helps or gives you an idea?

anriretief
Contributor III
Contributor III
Author

Thank you for the reply, I used the following:

LastWorkDate(weekstart(today()),networkdays(weekstart(today()),weekend(today()),'2020-06-25','2020-06-26'),'2020-06-25','2020-06-26') ... which then returns 2020-06-24 (assuming that 2020-06-25 and 2020-06-26 are holidays, although they are not in reality)