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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

forcing weekends or holidays into lastworkdate()

Hello

I have a start date,  [number of  working days]  and need to calculate the end date whilst resppecting the working days betwwen 'startDate' and 'startDate+ [number of  working days]'. the function lastworkdate() only calculates the earliest ending date to acheive number_of_workdays (Monday-Friday) the thing is i can have some workdays on saturdays or sundays too , and that function would not take them into account. is there any work arround for this?

you will find an example in the attached image in case if saturday 24th is a working day

thank you in advance for your help

Labels (1)
2 Replies
swuehl
Champion III
Champion III

I don't think you can tweak lastworkdate() to achieve what you want, but maybe by creating a calendar where you flag the working days, then assigning a consecutive working day number.

Retrieving the end date would then indeed just adding number of days to working day number of the start date.

tresB
Champion III
Champion III

See the attachment- an atlernate method. Used expression:

=Date(If(WeekDay(Date+vLastWorkingDateParam-1)>=5,Date+vLastWorkingDateParam-1,LastWorkDate(Date,vLastWorkingDateParam)))

You might have to modify according to user date system.