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 / How to check if a list...
Power Apps
Answered

How to check if a list of dates conflicts with a list date ranges?

(0) ShareShare
ReportReport
Posted on by 19

Hi

 

I have a Table called DaysToStore. It contains a field called Day that the user has picked.

There is also a Bookings Table, which has 3 fields, a unqiue BookingId, ReservedFrom and ReservedUntil.

I want to set Button1.OnSelect to create a new version of DaysToStore, with an added field called Clash.

 

For each record the value of Clash is either true or false if the Day >= ReservedFrom and Date <= ReservedUntil.

Here is my attempt but it doesn't work, and of course PowerApps is pretty bad and indicating why this might be...

ClearCollect(
NewDaysToStore, AddColumns( DaysToStore, "Clash", LookUp(Bookings, And(Day >= ReservedFrom, Day <= ReservedUntil), true)) 
)

Do you have any suggestions?

Categories:
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I've put together a test on my end and your code is working fine. Double check that DaysToStore.Day, Bookings.ReservedFrom, and Bookins.ReservedUntil are all date types. You can use DateValue() to ensure they are stored as dates.

    ClearCollect(
    NewDaysToStore, AddColumns( DaysToStore, "Clash", LookUp(Bookings, And(DateValue(Day) >= DateValue(ReservedFrom), DateValue(Day) <= DateValue(ReservedUntil)), true)) 
    )
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @apsuk 

     

    You can avoid usage of collection in this case by using the below formula:
     
    If(CountRows(Filter(Bookings, And(Day >= ReservedFrom, Day <= ReservedUntil))) = 0 ,"false","true")
     
    false means that there is no clash but true means that there is a clash.
     
    Hope this Helps!
     
    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @apsuk ,

    Could you please share a bit more about your scenario?

    Do you want to add a new Clash field with true or false value to your new DaysToStore table?

     

    Based on the formula that you mentioned, I think there is something wrong with it. I have made a test on my side, please consider take a try with the following formula:

    ClearCollect(
     NewDaysToStore, 
     AddColumns(
     DaysToStore, 
     "Clash", 
     If(
     !IsBlank(LookUp(Bookings, Day >= ReservedFrom && Day <= ReservedUntil)),
     true,
     false
     )
     ) 
    )

     

    Please consider take a try with above solution, then check if the issue is solved.

     

    Best regards,

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 354 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 320

#3
Mohsin Ali Profile Picture

Mohsin Ali 246

Last 30 days Overall leaderboard