How to get Next Working Weekday using Power Automate

Explores methods to find the next working weekday by creating an Instant Cloud Flow with a user-selected date input in Power Automate

Power Automate offer extensive automation capabilities, but working with DateTime functionalities can be challenging. In this blog, we’ll explore on how to get the next working weekday.

First, let’s create a new Instance Cloud Flow. Next, add a Date input within the trigger, allowing the user to select a data whenever the workflow is triggered. Name this input variable as ‘date‘. For example, the selected Date is 2024-05-25

Workflow Trigger with Date variable

Assuming Monday to Friday are weekdays and try to return the next date is in between these days.

Next, add a Compose action to the workflow and add the below expression,

if(
equals(dayOfWeek(addDays(triggerBody()?['date'],1)),6),
addDays(triggerBody()?['date'],3),
if(equals(dayOfWeek(addDays(triggerBody()?['date'],1)),0),
addDays(triggerBody()?['date'],2),
addDays(triggerBody()?['date'],1))
)
After the running the workflow, it returns the value as 2024-05-27
The above expression, first checks for next date is comes under Saturday or Sunday. If it is Saturday, adding 3 days to the selectd date and if it Sunday, adding 2 days to get the next working date.
Shantha Kumar
Shantha Kumar
Articles: 296