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 / Incrementing a DateTim...
Power Automate
Suggested Answer

Incrementing a DateTime Variable within a Do Until Loop

(0) ShareShare
ReportReport
Posted on by 37
I have a Do Until loop where I want to add 1 day to a variable 'CurrentDate', which has been initialized outside of the loop. I am using the Set Variable with addDays() to add the day to the CurrentDate variable, but when I save the flow, I get the following error:
 
Flow save failed with code 'WorkflowRunActionInputsInvalidProperty' and message 'The inputs of workflow run action 'Set_variable' of type 'SetVariable' are not valid. Self reference is not supported when updating the value of variable 'CurrentDate'.'.
 
Any ideas on what I am doing wrong?
Categories:
I have the same question (0)
  • Suggested answer
    AndrianaO Profile Picture
    213 Moderator on at
    Hi! Unfortunately, you cannot use self-reference inside the addDate() function, but I have an idea for you.

    How about using an additional integer variable called NumberOfDays? You need to initialize it outside the loop with a zero initial value. Then you can increment it inside the loop using the "Increment variable" action. After that, you can use the "Compose" action to add this incremented number of days to your CurrentDate. The formula in Compose action:
     
    addDays(variables('CurrentDate'),variables('NumberOfDays'))
     
     My test flow looks as follows:
     
     
    Let me know if this works for you!

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
Haque Profile Picture

Haque 58

#2
David_MA Profile Picture

David_MA 53 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 36 Most Valuable Professional

Last 30 days Overall leaderboard