Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Outlook
    • Planner
    • Power Apps
    • SharePoint
    • Teams
  • Triggers
  • Ready to use solutions
    • Approval Process Template
    • Task Delegation App
    • The Ultimate Power Automate expressions cheat sheet
    • Power Automate HTTP requests to SharePoint cheat sheet
    • Power Automate HTTP requests to Graph API cheat sheet
  • ABOUT ME
  • Get help with your flow
  • POWER PLATFORM SERVICES
Menu

Move weekend due date when creating Planner tasks in Power Automate

Posted on August 1, 2021August 1, 2021 by Tom

“How can I tell my Power Automate flow to create Planner tasks with due date only on working days, to skip weekend and move it to Monday instead?”


When you create Planner tasks automatically with Power Automate, you might automatically calculate also their due date. Take today’s date, add the desired task duration, and get the task due date. But here comes a small complication. If you created tasks manually, you wouldn’t select Saturday or Sunday as the due date. You’d probably move the due date to the next working day: Monday. But Power Automate won’t do that, unless you add the logic by yourself. And this article will show you how.

DayOfWeek(…) expression

The main expression for this solution is the dayOfWeek(…) expression. When you enter a date as a parameter, it’ll return a number from 0 to 6. Using today’s date, it’ll work as below:

dayOfWeek(utcNow())   will return 0 on Sunday
                                  1 on Monday
                                  ...
                                  6 on Saturday

The same logic can be used on any date. It can be a calculated date or a date from other source, e.g. a date of a task imported from an Excel file. Following the Excel example, let’s take the basic expression: if the date cell in Excel is not empty, you use the date. The date must be in the ISO 8601 format.

if(
  equals(items('Apply_to_each')?['DueDate'],''),
    null, 
    items('Apply_to_each')?['DueDate']
)

Ignoring the condition that the value shouldn’t be empty, take just the date dynamic content.

items('Apply_to_each')?['DueDate']

Since it’s a valid date, it can be used in the dayOfWeek(…) expression. It’ll return a number from 0 to 6 depending on the day of the week. But you’re interested only if it’s 0 or 6, the weekend.

dayOfWeek(items('Apply_to_each')?['DueDate'])

Is it Sunday?

If it’s 0, it’s Sunday and you must add 1 day to turn it into Monday. Here you’ll combine it with the if(…) expression as already described in article on empty dates.

if(
  equals(dayOfWeek(items('Apply_to_each')?['DueDate']),0),
    <ifTrue..Sunday>,
    <ifFalse..NotSunday>)
)

If true, it’s Sunday, add 1 more day with the addDays(…) expression.

if(
  equals(dayOfWeek(items('Apply_to_each')?['DueDate']),0),
    addDays(items('Apply_to_each')?['DueDate'],1),
    <ifFalse..NotSunday>
)

Is it Saturday (or Sunday)?

Now it’s time to do the same for Saturday. Extending the expression above, if the condition is false (it’s not Sunday), let’s check if it’s Saturday. If it’s Saturday, you must add 2 days to turn it into Monday.

if(
  equals(dayOfWeek(items('Apply_to_each')?['DueDate']),0),
    addDays(items('Apply_to_each')?['DueDate'],1),
    if(equals(dayOfWeek(items('Apply_to_each')?['DueDate']),6),
       addDays(items('Apply_to_each')?['DueDate'],2),
       <ifFalse..NotSundayNorSaturday>
    )
)

And if it’s not Saturday nor Sunday, you can take the date as is.

if(
   equals(dayOfWeek(items('Apply_to_each')?['DueDate']),0),
     addDays(items('Apply_to_each')?['DueDate'],1),
     if(
       equals(dayOfWeek(items('Apply_to_each')?['DueDate']),6),
         addDays(items('Apply_to_each')?['DueDate'],2),
         items('Apply_to_each')?['DueDate']
     )
)

The last step is to add back the condition if the field is empty.

if(
  equals(items('Apply_to_each')?['DueDate'],''),
    null, 
    if(
      equals(dayOfWeek(items('Apply_to_each')?['DueDate']),0),
        addDays(items('Apply_to_each')?['DueDate'],1),
        if(
          equals(dayOfWeek(items('Apply_to_each')?['DueDate']),6),
            addDays(items('Apply_to_each')?['DueDate'],2),
            items('Apply_to_each')?['DueDate']
        )
    )
)
Power Automate Planner tasks weekend

Summary

The solution above is not limited to skipping weekend when creating Planner tasks with Power Automate. With the dayOfWeek(…) expression you can build many interesting solutions, e.g. to run a flow only on specific day in a specific week in a month. Just remember that the week starts with 0 on Sunday and ends with 6 on Saturday.

But that was only one part of the solution, the other one is the if(…) expression. It’s a powerful expression which can help you save a lot of flow actions. As you can see in the final expression, it’s 3 IFs deep, and you could go much deeper if needed. You could achieve the same functionality with a variable and 3 levels of ‘Conditions’, or you can have 1 composed expression…


πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Working on an Approval process?

Use the Approval Process Template and the Task Delegation App to skip the hard part and deploy a fully functional approval solution on a SharePoint list in minutes! And then the next one, and the next one...

Approval Template Preview ✨ Learn more ✨

Turn ideas into flows with ease!

Grab the complete Power Automate Cheat Sheet Bundleβ€”everything you need to master expressions, SharePoint HTTP calls, and Graph API in Power Automate.

Cheat Sheet Bundle Preview ✨ Get the Cheat Sheets

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with thousands of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2025 Let's POWER Automate | Theme by SuperbThemes