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. For more information, see Modifying regional settings for apps and scripts.

Default regional settings in apps are based on the user profile. These regional format settings are not related to the language displayed in the Qlik Cloud user interface. Qlik Cloud will be displayed in the same language as the browser you are using.

If you are an app creator, you can set the default region for apps you create. For more information, see Setting your preferred regional settings for creating apps and scripts in Qlik Cloud Analytics.

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!