Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Filter(Sort(col_Desks,Title),Active=1&& Not(// Not reserved for the selected date and time span
Title in Filter(col_Reservations,(DateTimeValue(Text('Check Out From Text',DateTimeFormat.ShortDate)) >=DateTimeValue(Text(startTime,DateTimeFormat.ShortDate))||
DateTimeValue(Text('Check Out To Text',
DateTimeFormat.ShortDate))>DateTimeValue(Text(endTime,DateTimeFormat.ShortDate)))
//&&// Same dateMeeting Rooms/ Desks Selections Screen)
.Title),MaxCapacity>=CountRows(NameOfPeopleComboBoxNewBooking.SelectedItems)&&MinCapacity<=CountRows(NameOfPeopleComboBoxNewBooking.SelectedItems))
Solved! Go to Solution.
Not working, same error showing both meeting room same time and date.
I have attached the image also please check.
To avoid double bookings for the same time and date in a PowerApp, especially when dealing with resources like meeting rooms or desks, you need to create a logical filter that checks for existing reservations before allowing a new booking. The approach you're taking is generally correct, but let's refine it to ensure it effectively prevents double bookings.
Your current formula is a good start, but it seems a bit complex and might be missing some elements for clarity. The key is to ensure that for any given slot you want to book, there are no existing reservations that overlap with it. Here’s a more streamlined approach:
1. Define the Time Range for the New Booking: You need to have a clear definition of the start and end time for the new booking. Let’s assume `startTime` and `endTime` are your variables holding these values.
2. Filter the Available Slots: You need to filter your `col_Desks` (or any other resource collection) to find those that are not reserved during the specified time range.
3. Check for Overlapping Bookings: The main part of the filter will check for overlapping bookings. A booking overlaps if either:
- It starts before the new booking ends and ends after the new booking starts.
- It starts and ends within the new booking time frame.
Here is a simplified version of the formula that you might use:
Filter(
col_Desks,
Active = 1,
Not(
Title in Filter(
col_Reservations,
(DateTimeValue(Text(CheckOutFrom, DateTimeFormat.ShortDate)) < DateTimeValue(Text(endTime, DateTimeFormat.ShortDate))
&&
DateTimeValue(Text(CheckOutTo, DateTimeFormat.ShortDate)) > DateTimeValue(Text(startTime, DateTimeFormat.ShortDate)))
).Title
),
MaxCapacity >= CountRows(NameOfPeopleComboBoxNewBooking.SelectedItems),
MinCapacity <= CountRows(NameOfPeopleComboBoxNewBooking.SelectedItems)
)
In this formula:
- `CheckOutFrom` and `CheckOutTo` should be fields in your `col_Reservations` collection that indicate the start and end times of existing bookings.
- `DateTimeValue(Text(..., DateTimeFormat.ShortDate))` is used to ensure that the times are correctly formatted and comparable.
This formula assumes:
- `col_Desks` is your collection of bookable resources.
- `col_Reservations` is your collection of existing bookings.
- `MaxCapacity` and `MinCapacity` are fields in `col_Desks` that define the capacity limits for the resource.
Remember, PowerApps formulas can be quite sensitive to syntax and context, so you might need to adjust this based on your specific app's design and data structure. Always test thoroughly to ensure it handles all booking scenarios correctly.
Proud to be a Super User!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.