Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
jaymerry
Creator
Creator

Lats workday of a month

Hello all,

Do you know how could I find the last workday of a month ?

Thanks for your help,

Best regards,

Jaymerry

1 Solution

Accepted Solutions
jaymerry
Creator
Creator
Author

Hello,

If it can help someone, I have find the solution (where $vMaxDay is the last day of a month) :

Lastworkdate(date(monthstart('$(vMaxDay)',-1),'YYYY-MM-DD'),NetWorkDays(date(monthstart('$(vMaxDay)',-1),'YYYY-MM-DD'),date(monthend('$(vMaxDay)',-1),'YYYY-MM-DD'))) as Last_WorkDay

Regards,

Jaymerry

View solution in original post

2 Replies
Denis_Brajkovic
Former Employee
Former Employee

Hi,

You can use function LastWorkDate (see explaination below from the reference manual):

lastworkdate( start_date, no_of_workdays {, holiday} )

Returns the earliest ending date to acheive 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.

Example:

lastworkdate ('2007-02-19', 9) returns '2007-03-01'

lastworkdate ('2006-12-18', 8, '2006-12-25', '2006-12-26') returns

'2006-12-29'



jaymerry
Creator
Creator
Author

Hello,

If it can help someone, I have find the solution (where $vMaxDay is the last day of a month) :

Lastworkdate(date(monthstart('$(vMaxDay)',-1),'YYYY-MM-DD'),NetWorkDays(date(monthstart('$(vMaxDay)',-1),'YYYY-MM-DD'),date(monthend('$(vMaxDay)',-1),'YYYY-MM-DD'))) as Last_WorkDay

Regards,

Jaymerry