Skip to main content
Community site session details

Community site session details

Session Id : kP/yVBLkeTT1WJP2ilUapn
Power Apps - Building Power Apps
Answered

Create collection of two date ranges compared

Like (0) ShareShare
ReportReport
Posted on 28 Jul 2023 10:44:55 by 78

Hello,

 

i'm trying to create a collection which is made up of every day in the year in one column (so 365 rows) and then looking at a SharePoint list which has a start date and end date column. I want the collection to add a column with a value of '1' for the corresponding date ranges used. Its for a leave request app so the new collection should be made up of every day of the year and then a 1 against the days that the individual is on leave.

 

I've made a collection of the 365 days (colYearCal) and thought i could create a new collection with a lookup to the sharepoint list, but its getting beyond me and i'm sure there's a simple answer.

 

Can anyone help please?

Categories:
  • Verified answer
    v-bofeng-msft Profile Picture
    on 31 Jul 2023 at 02:16:01
    Re: Create collection of two date ranges compared

    Hi @SimpleUser ,

     

    I've made a test for your reference:

     

    I created a colYearcal for test

    ClearCollect(colYearCal,ForAll(Sequence(365,0,1),{Date:DateAdd(Date(2023,1,1),Value,TimeUnit.Days),Count:0}))

     

    vbofengmsft_0-1690769398698.png

    I've made a collection to imitate the SharePoint list:

    ClearCollect(SPlist,{StartDate:Date(2023,1,1),EndDate:Date(2023,1,2)},{StartDate:Date(2023,1,4),EndDate:Date(2023,1,4)})

    vbofengmsft_1-1690769592311.png

    Update colYearCal

    UpdateIf(colYearCal,!IsBlank(LookUp(SPlist,Date<=EndDate && Date>=StartDate)),{Count:1})

    vbofengmsft_2-1690769752366.png

     

    Best Regards,

    Bof

     

     

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete