Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi there
I have a field called (DocDate).
How can I add 10 working days (networkdays) to this date given by (DocDate)?
Thank you
There's a function for this in QlikView:
lastworkdate( start_date, no_of_workdays {, holiday} )
Returns the earliest ending date to achieve number_of_workdays (Monday-Friday) if starting at start_date taking into account any optionally listed holidays. Start_date and number_of_workdays should be valid dates or timestamps.
Examples:
lastworkdate ('2007-02-19', 9) returns '2007-03-01'
lastworkdate ('2006-12-18', 8, '2006-12-25', '2006-12-26') returns '2006-12-29'
It can probably can be improved
if(weekday(Date+10+(10-Networkdays(Date,Date+10)))=0,Date+10+(10-Networkdays(Date,Date+10))+1,
if(weekday(Date+10+(10-Networkdays(Date,Date+10)))=5,Date+10+(10-Networkdays(Date,Date+10))+2,
Date+10+(10-Networkdays(Date,Date+10))
)
)
Much simpler
Date + 10 +
if(weekday(Date)=6,2,
if(weekday(Date)=0,1,
3))
There's a function for this in QlikView:
lastworkdate( start_date, no_of_workdays {, holiday} )
Returns the earliest ending date to achieve number_of_workdays (Monday-Friday) if starting at start_date taking into account any optionally listed holidays. Start_date and number_of_workdays should be valid dates or timestamps.
Examples:
lastworkdate ('2007-02-19', 9) returns '2007-03-01'
lastworkdate ('2006-12-18', 8, '2006-12-25', '2006-12-26') returns '2006-12-29'
Lastworkdate() may be all you need. If it's not enough, I have and can post a couple examples that may help. One loads the holiday list from a table instead of requiring you to type them all in the expression. Another deals with cases where you might work on a weekend day, so want to include some of them. Both may be more complicated than you require.
Thanks guys.
It worked perfectly. It gave me exactly what I wanted. It gave me a duedate that is generated by taking the document date & adding 10 working days. I used the following in my script.
lastworkdate
(DocDate,10) as PODueDate
Hi Wim,
How would you set which weekdays should be referred as working days?
I understood the default is Monday-Saturday, but how can I change it to Sunday-Friday?
I tried modifying FirstWeekDay attribute with no success.