Skip to main content Skip to complementary content

lastworkdate - script and chart function

The lastworkdate function returns the earliest ending date to achieve no_of_workdays (Monday-Friday) if starting at start_date taking into account any optionally listed holiday. start_date and holiday should be valid dates or timestamps. 

Syntax:  

lastworkdate(start_date, no_of_workdays {, holiday})

Return data type: integer

A calendar that shows how the lastworkdate() function is used

Diagram that shows a calendar of a month. The start date of work is set on the 10th of the month and the end date of work is set on the 26th. The days inbetween the start and end date, excluding Saturdays and Sundays, are highlighted in green.

There is no method to modify the lastworkdate() function for regions or scenarios that involve anything other than a work week that begins on Monday and ends on Friday.

The holiday parameter must be a string constant. It does not accept an expression.

The lastworkdate() function is commonly used as part of an expression when the user would like to calculate the proposed end date of a project or assignment, based on when the project begins and the holidays that will occur in that period.

Regional settings

Unless otherwise specified, the examples in this topic use the following date format: MM/DD/YYYY. The date format is specified in the SET DateFormat statement in your data load script. The default date formatting may be different in your system, due to your regional settings and other factors. You can change the formats in the examples below to suit your requirements. Or you can change the formats in your load script to match these examples.

Default regional settings in apps are based on the regional system settings of the computer or server where Qlik Sense is installed. If the Qlik Sense server you are accessing is set to Sweden, the Data load editor will use Swedish regional settings for dates, time, and currency. These regional format settings are not related to the language displayed in the Qlik Sense user interface. Qlik Sense will be displayed in the same language as the browser you are using.

Arguments
Argument Description
start_date The start date to evaluate.
no_of_workdays The number of working days to achieve.
holiday

Holiday periods to exclude from working days. A holiday is stated as a string constant date. You can specify multiple holiday dates, separated by commas.

Example: '12/25/2013', '12/26/2013', '12/31/2013', '01/01/2014'

Example 1 - Basic example

Example 2 - Single holiday

Example 3 - Multiple holidays

Example 4 - Single holiday (chart)

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!