Amazon QuickSight – netWorkDays
The networkdays function in Amazon QuickSight calculates the number of business days between a start date and an end date, excluding weekends and any holidays that you specify.
Syntax
#Start# NETWORKDAYS(startDate, endDate[, holidayList]) #End#
This function takes three arguments:
- startDate (required): the start date of the date range.
- endDate (required): the end date of the date range.
- holidayList (optional): a list of holidays to exclude from the calculation. This parameter should be a comma-separated list of dates in the format MM/DD/YYYY.
Suppose you have a dataset containing a list of tasks with their start and end dates, and you want to calculate the number of business days between the start and end dates of each task.
Assume the following dataset:
| Task ID | Start Date | End Date |
| 1 | 02/25/2023 | 03/07/2023 |
| 2 | 03/01/2023 | 03/14/2023 |
| 3 | 03/07/2023 | 03/12/2023 |
| 4 | 03/08/2023 | 03/15/2023 |
| 5 | 03/11/2023 | 03/18/2023 |
To calculate the number of business days between the start and end dates of each task, you can create a calculated field using the networkdays function:
Example
#Start# NETWORKDAYS({Start Date}, {End Date}) #End#
This will result in a new column showing the number of business days between the start and end dates of each task:
| Task ID | Start Date | End Date | Networkdays |
| 1 | 02/25/2023 | 03/07/2023 | 9 |
| 2 | 03/01/2023 | 03/14/2023 | 10 |
| 3 | 03/07/2023 | 03/12/2023 | 3 |
| 4 | 03/08/2023 | 03/15/2023 | 6 |
| 5 | 03/11/2023 | 03/18/2023 | 5 |
In this example, the networkdays function calculates the number of business days between the start and end dates of each task, excluding weekends and any holidays that you specify. If you wanted to exclude specific holidays from the calculation, you could add a third parameter to the function containing a comma-separated list of the holiday dates in the format MM/DD/YYYY.