web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : 4/3uQINf+pd1VxR8REff2n
Power Automate - Building Flows
Answered

MS Planner - Due Date and Return Date Calculations

Like (0) ShareShare
ReportReport
Posted on 18 Jul 2022 10:09:05 by

Hi,

 

I'm using MS planner and have the following for created tasks:

 

Start Date: equal to the date the MS form is submitted)

Due Date: 90 days before the 'Return date' which is a date submitted in the MS Form.

 

This works perfectly well in most cases, but very occasionally when the 'Return Date' submitted on the form is less than 90 days, it causes the flow to fail as the Return Date minus 90 days ends up being before the Start Date (the date the form was created).

 

I had an expression for this, which I've since deleted (and cant remember!). Does anyone have an idea how this might be avoided?

I have the same question (0)
  • Barking_Mad1 Profile Picture
    on 18 Jul 2022 at 14:34:26
    Re: MS Planner - Due Date and Return Date Calculations

    Thanks for your help, it's really appreciated. Works as intended 🙂

  • Verified answer
    David- Profile Picture
    1,254 on 18 Jul 2022 at 13:16:53
    Re: MS Planner - Due Date and Return Date Calculations

    I don't know how I can do any better of a job of explaining than what is in the post I linked to except to give you a screen shot of the actions used for these expressions:

     

    Expression 1 goes into Initialize variable varStartDateTicks: 

    • ticks(triggerBody()?['StartDate'])

    Expression 2 goes into Initialize variable VarEndDateTicks:

    • ticks(triggerBody()?['EndDate'])

    Expression 3 goes into Compose Difference:

    • div(sub(variables('varEndDateTicks'),variables('varStartDateTicks')),864000000000)

    The result will be the difference between the two dates.

    David_0-1658149800689.png

    If you have named everything as above, the only issue you might have are the triggerBody()?['StartDate'] and triggerBody()?['EndDate'] variables as they come from your data source. When building the expression, after you type ticks() switch over to Dynamic content and choose your variable and it will populate into the expression.

  • Barking_Mad1 Profile Picture
    on 18 Jul 2022 at 13:06:10
    Re: MS Planner - Due Date and Return Date Calculations

    Thanks, unfortunately I'm useless with expressions. Can you help me write the formula? I think I can do the second one, but the first one.....Im not sure how to do this using ticks and SubmissionTime, or should it be utcNow() ?

     

  • David- Profile Picture
    1,254 on 18 Jul 2022 at 12:25:07
    Re: MS Planner - Due Date and Return Date Calculations

    I think the easiest thing to do would be to calculate the number of days between the start date and due date. Then add a condition to check if the difference is greater than 90 days. Maybe that is the expression you are looking for, as there is no simple datediff expression in Power Automate. You need to calculate the ticks. This post will explain how to do that: dynamics crm - DateDiff() Function in PowerAutomate: Where is it? - Stack Overflow

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 736 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 396 Moderator

#3
Power Apps 1919 Profile Picture

Power Apps 1919 339

Last 30 days Overall leaderboard
Loading started