Feb 06, 2023 12:19 PM
Hello, I'm stuck trying to figure out how many workdays exist in a given month. It is easy enough to get the number of workdays between a start and end date using the WORKDAY_DIFF() function, and it also seems possible to collect the total number of days per month. However, I have not come across a solution to determine the number of workdays per month. Any help would be appreciated!
Feb 06, 2023 01:45 PM
Hi Cody,
You could use a table with Start Dates and End Dates. Each record would have the start date as the 1st of each month and end date as the last of each month. Then, create a formula column using the WORKDAY_DIFF() function. But I'm not sure if this will help since I don't know your exact application.
If you want to schedule some time with me, here's my Calendly link: https://calendly.com/d/2cd-f86-8r6/30-minute-help-meeting
Jody
Feb 06, 2023 01:52 PM
Thanks Jody,
I have a table with a list of projects, each with a start and end date as well as total number of hours. The day of the month for both start and end dates vary depending on the project. While it's easy enough to obtain the number workdays for the entire time span, what eludes me is how to get the number of workdays per month, so that it is then possible to determine the number of hours per month.
Feb 06, 2023 05:06 PM
Hmm, assuming you've got a "Date" field per record that would be used to determine the month in question, you could try:
WORKDAY_DIFF(
DATETIME_PARSE(
YEAR(Date) & '-' & MONTH(Date),
'YYYY-MM'
),
DATEADD(
DATEADD(
DATETIME_PARSE(
YEAR(Date) & '-' & MONTH(Date),
'YYYY-MM'
),
1,
'month'
),
-1,
'day'
)
)
Feb 07, 2023 01:53 PM
Thanks for that Adam. A much cleaner approach to getting total workdays per month than what I tried! But, I'm trying to build out not just the total workdays per month; I'm trying to to build out the number of workdays in each month based on when a project starts and ends. Here is an example: Example Project Tracker