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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Action 'Subtract_from_...
Power Automate
Answered

Action 'Subtract_from_time' failed

(0) ShareShare
ReportReport
Posted on by 29

Hi PA experts,

 

I am launching a Microsoft Request form for internal use, in which I wanted to set up an automated action as follows:

- The requestors are required to fill in their expected delivery date, our team are rejecting any delivery date that is less than 3 weeks from the submission date

- I set up a PA workflow in which once the form is submitted, PA will calculate the difference in days between the expected delivery date and the submission date. Then it will apply a condition to see if the calculated time is less than 21 days, an automatic rejection email will be sent to the requestor.

 

However, on the test run, I encountered the error "Action 'Subtract_from_time' failed", detailed in the screenshot (NB - I set the submission date to be based time, the other to be the interval)

 

Could anyone please kindly advise what might go wrong and suggest some ways for correction? Any great advice on a different way to handle my scenario would be highly appreciated! 

 

Thanks in advance!

 

Albus 

albusbui_0-1678825883122.png

 

Categories:
I have the same question (0)
  • Verified answer
    v-dezhili-msft Profile Picture
    Microsoft Employee on at

    Hi @albusbui ,

     

    Interval needs an integer in Subtract_from_time' failed actin, you cannot fill in a date here.
    If you want to calculate the number of days between two dates use the dateDifference() formula.

    vdezhilimsft_0-1678862292427.png

    split(dateDifference(outputs('Start_Date'),outputs('End_Date')),'.')[0]

    vdezhilimsft_1-1678862317425.png

     

    Best Regards,

    Dezhi

     

     

  • Chriddle Profile Picture
    8,638 Super User 2026 Season 1 on at

    Convert your dates to ticks, subtract them and divide the result by the number of ticks per day:

    div(sub(ticks('2023-03-13T12:01:38'), ticks('2023-04-30')), 864000000000)

     

  • albusbui Profile Picture
    29 on at

    Thanks so muchhh, Dezhi! This looks like it works with your function. However, once I applied the output for the next Condition in the flow, it showed again the error about 'String' and 'Integer' value... Could you please advise? Thank you! 

    albusbui_0-1678888985274.png

     

    albusbui_1-1678889010580.png

     

  • albusbui Profile Picture
    29 on at

    Thanks again, Dezhi. I added string(21) and it worked well now. Regards,

  • Chriddle Profile Picture
    8,638 Super User 2026 Season 1 on at

    The return value of @v-dezhili-msft 's expession is a string. You can convert it with the function int().

    However, I recommend using the tick() approach because the return value of the dateDifference() function is strange. Compare differences of more and less than a day ‌‌😉, split(...)[0] will not return the desired value!

  • albusbui Profile Picture
    29 on at

    Hi @Chriddle @v-dezhili-msft 

     

    Thank you both for  your advice. A new issue has occurred which I assume it relates to @Chriddle 's highlights 'Compare differences of more and less than a day ‌, split(...)[0] will not return the desired value!'. Please see below:

     

    I use the split approach and there's no error, but the end result made me confused.

    I ran a test showing the difference in days are 4 days (less than 21 days as we required), but the condition appeared as False (see below). I am not sure if the issue was because I set up the flow wrongly, or is it due to the split approach?

     

     

    albusbui_2-1678982770752.png

     

    Here's the original flow for your reference.

    albusbui_1-1678982750543.png

     

    @Chriddle Could you please kindly advise how I can set up the tick approach properly in this case? In particular, how can I add submission date and expected date to the formula/expression? Thank you very much!

  • Verified answer
    Chriddle Profile Picture
    8,638 Super User 2026 Season 1 on at

    When comparing strings, you compare characters from left to right. Therefore "4" is greater than "21".

    That's why I suggested the integer comparison.

     

    split(dateDifference(outputs('Start_Date'),outputs('End_Date')),'.')[0] fails if the difference is less than one day,
    because the dateDifference() function doesn't return a value with days and a period, just hh:mm:ss.

     

    To implement the expression provided above, simply add it to a compose action (as an expression) and replace both date strings with your dates from the dynamic expressions.

    The output is an Integer with the difference in days. You won't have any trouble comparing it.

     

    Chriddle_0-1678984678615.png

    div(sub(ticks(outputs('End_Date')), ticks(outputs('Start_Date'))), 864000000000)

     

     

  • albusbui Profile Picture
    29 on at

    Thanks a ton @Chriddle  -- that worked flawlessly! Appreciated!

    Albus

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 251 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 239

#3
Expiscornovus Profile Picture

Expiscornovus 220 Most Valuable Professional

Last 30 days Overall leaderboard