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 Apps / Iterate over each Day ...
Power Apps
Answered

Iterate over each Day between StartDate and EndDate by using ForAll

(0) ShareShare
ReportReport
Posted on by 95
Hi All,
I have a connector which should be return somedata based on From date to To date.
Ex: 03/11/2020 to 05/11/2020. Like For loop, based on start and end date. Can some help me on this by using ForAll in powerapps.
Like below:
 
for(DateTime date = StartDate; date.Date <= EndDate.Date; date = date.AddDays(1))
{
...
}
Categories:
I have the same question (0)
  • v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @BKGOUD ,

     

    The number of iterations of ForAll() function depends on the number of rows in collection, so first use DateDiff() function to get the total number of days, and use sequence() function to generate a sequence collection. Please try this:

    ForAll(
    Sequence(DateDiff(StartDate, EndDate, Days)),
    ...
    )

     

    Hope this helps.

    Sik

  • BKGOUD Profile Picture
    95 on at

    Hi @v-siky-msft ,

     

    Thanks for helping me.

    I'm using the findmeetingstimes connector to loop based on the start date and end date.

    So, i have to run my loop based on date and by startdate and enddate each iteration to the connector.

    Could you please help me on this.

     

    ClearCollect(
    ConflictsRooms,
    Office365.FindMeetingTimes(
    {
    RequiredAttendees: AllRoomsConnector,
    IsOrganizerOptional: true,
    Start: DateTimeValue(StartDateTimeUTC1),
    End: DateTimeValue(EndDateTimeUTC1),
    MeetingDuration: 60,
    MinimumAttendeePercentage: "1",
    ActivityDomain: "Unrestricted"
    }
    )
    );

  • Verified answer
    v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @BKGOUD ,

     

    Sequence() function generates a sequence collection starts from 1, so the start and end parameter is based on the StartDate and sequence value of the current loop.

    Clear(ConflictsRooms);
    ForAll(

    Sequence(DateDiff(StartDate, EndDate, Days)),

    Collect(
    ConflictsRooms,
    Office365.FindMeetingTimes(
    {
    RequiredAttendees: AllRoomsConnector,
    IsOrganizerOptional: true,
    Start: DateAdd(StartDate, Value-1),
    End: DateAdd(StartDate, Value),
    MeetingDuration: 60,
    MinimumAttendeePercentage: "1",
    ActivityDomain: "Unrestricted"
    }
    )
    );

    )

     

    Hope this helps.

    Sik

     

     

     

     

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 541

#2
WarrenBelz Profile Picture

WarrenBelz 434 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 289

Last 30 days Overall leaderboard