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

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Prevent Overlapping Schedules with Date Picker

(0) ShareShare
ReportReport
Posted on by 28
We have a reservation app that uses the date picker; I'd like to prevent double booking or overlapping reservations but I am not sure how to tackle it.
 
We have a Workspace drop-down that has 4 different workspace areas to choose from; so technically there can be overlapping dates/times as long as the workspace is not the same. What would be the best approach to preventing overlapping/double-booking?
I have the same question (0)
  • oyepanky Profile Picture
    202 on at
    Prevent Overlapping Schedules with Date Picker

    HI @Kbostwick

    You can handle this by checking for overlaps before saving the reservation. The key is to only compare against bookings in the same workspace. When a user selects a workspace, start date, and end date:

     

    1. Look at your reservations table and filter for records where: > The workspace matches the one just selected. > The new date range overlaps with an existing one.

    2. If you find a match, show an error message like: > “This workspace is already booked for that time.”

    3. If there’s no conflict, go ahead and save the booking.

     

    That way:

    Two people can book different workspaces at the same time  > But no one can double-book the same workspace

    This check can be done with a simple formula on your save button.

    Sample Formula > On save Button On select Property 

    If(
        CountRows(
            Filter(
                Reservations,
                Workspace = dd_Workspace.Selected.Result &&
                (
                    (DatePickerStart.SelectedDate <= EndDate && DatePickerEnd.SelectedDate >= StartDate)
                )
            )
        ) > 0,
        Notify("This workspace is already booked during the selected time. Please choose a different slot.", NotificationType.Error),
        // Else: proceed to save
        Patch(Reservations, Defaults(Reservations), {
            Workspace: dd_Workspace.Selected.Result,
            StartDate: DatePickerStart.SelectedDate,
            EndDate: DatePickerEnd.SelectedDate
        })
    )
     

  • WarrenBelz Profile Picture
    150,771 Most Valuable Professional on at
    Prevent Overlapping Schedules with Date Picker
    You have not provided much detail - for instance is the booking for a period or just one day? Is time of day involved ?​​​​
    Can you also please share your current code (in text), your list, field and control names and a screenshot of what you have presently.
    As an example, if your booking is over more than one day, you can do something like this
    With(
       {
          _Booked:
          Filter(
             SPListName,
             (
                StartDateField <= StartDatePicker.SelectedDate &&
                EndDateField >= StartDatePicker.SelectedDate
             ) ||
             (
                StartDateField <= EndDatePicker.SelectedDate &&
                EndDateField >= EndDatePicker.SelectedDate
             ) ||
             (
                StartDateField >= StartDatePicker.SelectedDate &&
                EndDateField <= EndDatePicker.SelectedDate
             )
          ),
          If(
             CountRows(_Booked) > 0,
             Notify(
                "Time period already booked",
                NotificationType.Error,
                5000
             ),
             YourNormalBookingCodeHere
          )
       )
    )
    which covers any start or end date in a period already booked as well as a booking completely overlapping another one. Note the >= and/or <= my be > or < depending if bookings can start the day another ends or end the day another starts.
     
    Please Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful?
    Visit my blog
    Practical Power Apps    LinkedIn

     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Tom Macfarlan – Community Spotlight

We are honored to recognize Tom Macfarlan as our Community Spotlight for October…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 1,019 Most Valuable Professional

#2
developerAJ Profile Picture

developerAJ 436

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 281 Super User 2025 Season 2

Last 30 days Overall leaderboard