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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Automate
Suggested Answer

Loop date day by day

(1) ShareShare
ReportReport
Posted on by
Is it possible to loop through dates day by day? i want to start from 2023-12-26 until 2025-01-27 based on the day, for example it would start on 2023-12-26 and the next loop would be 2023-12-27, like that until 2025-01-27
I have the same question (0)
  • Suggested answer
    trice602 Profile Picture
    15,404 Super User 2025 Season 2 on at
    Hi,
     
    Here's a quick flow that shows the framework.
     
     
    I'm starting off with a data table to show you the results; you may not need that in your automation but shown here for results.
     
    Next I am getting the current date so I can look back to the date 01/26/2024.  
     
    Add to datetime subtracts 32 days from today so my starting date is 01/26/2024 (32 days TimeDifference).
     
    Then I loop through from 1 to (32) by 1.
     
    Then I add 1 to the starting date (ResultedDate) and store in ResultedDate2.
     
    Next insert row into data table.
     
     
    Variables.CreateNewDatatable InputTable: { ^['Column1'], [$''''''] } DataTable=> DataTable
    DateTime.GetCurrentDateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateAndTime CurrentDateTime=> CurrentDateTime
    DateTime.Add DateTime: CurrentDateTime TimeToAdd: -32 TimeUnit: DateTime.TimeUnit.Days ResultedDate=> ResultedDate
    DateTime.Subtract FromDate: CurrentDateTime SubstractDate: ResultedDate TimeUnit: DateTime.DifferenceTimeUnit.Days TimeDifference=> TimeDifference
    LOOP LoopIndex FROM 1 TO TimeDifference STEP 1
        DateTime.Add DateTime: ResultedDate TimeToAdd: LoopIndex TimeUnit: DateTime.TimeUnit.Days ResultedDate=> ResultedDate2
        Variables.AddRowToDataTable.AppendRowToDataTable DataTable: DataTable RowToAdd: ResultedDate2
    END
    
     
     

    ------------------------------------------------

     

     

    ⭐ If this was helpful, please like and mark as a verified answer to help others find this too!

     

     

    Always glad to help! 💯💯💯💯💯

     

    Tom

     

    Follow me on LinkedIn - Thomas Rice, PMP | LinkedIn

  • trice602 Profile Picture
    15,404 Super User 2025 Season 2 on at
    Hey there!
     
    I am following up on this post loop date day by day in this category power automate desktop from 01/27/2025.  I know the post is a little older, but it is a common question here so wanted to take a moment and follow-up. I see there have been 1 replies and 1 likes and asking if your question has been answered.  If so, please help the community out by completing one or more of the following actions!  Thanks in advance!
     
    Easy as 1-2-3 ‼️💯⭐😎🆒🙏
     
    1) Mark a reply as a verified answer - this is essential, and it helps others with the same general question find this thread. ✅
    2) You can also mark one of more replies as a verified answer.  Please take a moment and give the author credit for volunteering their time. ✌️
    3) Like one or more replies.  Kudos always greatly appreciated! 👍
     
    Pro tip:  if you found your own solution or workaround, feel free to add a reply to your own post and mark it as the solution too!  The goal is to get this thread marked with a verified answer by anyone that finds one or more replies helpful!
     
    Again, thanks in advance for reading and responding, always glad to help!  Tom 💯💯💯💯💯
  • trice602 Profile Picture
    15,404 Super User 2025 Season 2 on at
    If I can help with anything else please let me know or tag me in a future post, I enjoy reading and answering questions.  Always glad to help!  Tom 💯💯💯💯💯

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard