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 Apps
Suggested Answer

Multiple Filters

(1) ShareShare
ReportReport
Posted on by 23
Hi I have two Sharepoint lists
 
Vehicles - a list of cars
Bookings - the dates the cars have been booked by users (Booking Start and Booking End) plus the time period (Booking Time Period column)  they were booked for, there are three options "Morning, Afternoon, or All Day" for this coloumn.
 
I'm building a powerapp that enables users to find cars that are available  on certain dates and also for available for either morning, afternoon or all day booking, by entering the start and end dates in date pickers and then a drop down list of the three options 
 
I have this filter (Title = the vehicle registration)
 
Filter('Vehicles List',!(Title in Filter('Bookings List',('Booking Start'>=DateFrom && 'Booking End'<=DateTo) || ('Booking Start'>=DateFrom && 'Booking End'<=DateTo)).Title))
 
Which is working fine for the dates, but I cannot figure out the logic for filtering out the bookings by "session" made on the dates selected so that if users chooses the following:
  • "Morning"  only returns those cars available for the morning excludes bookings already made for morning,  and made all day

  • "Afternoon"  only returns those available for the afternoon excludes bookings already made for afteroon,  and made all day

  • "All Day" only returns those available for all day excludes bookings already made for morning, afternoon  and made all day
Categories:
I have the same question (0)
  • Suggested answer
    SyedBilal Profile Picture
    42 on at


    Hey! Two things going on here — and one of them is a bug in your existing filter you may not have noticed. Let me untangle it.

    First, a quick fix to your date logic. Your current condition has the same thing on both sides of the ||:

     
     

    Also, that condition only catches bookings that fall entirely inside the user's selected range — it misses bookings that start before or end after. The standard "do two date ranges overlap?" check is much simpler:

     
     

    That single line catches every overlap case.

    Now for the session logic. The trick is to flip the question around: instead of "what session did they pick?", ask "which booked sessions would conflict with the one they picked?" That gives you a clean lookup:

     

    User picks Conflicts with
    Morning Morning, All Day
    Afternoon Afternoon, All Day
    All Day
    Morning, Afternoon, All Day


     

    Then you just check if the booking's session is in that conflict list. Power Fx makes this elegant with Switch + in:

     
     

    Replace SessionDropdown with whatever you've named your session dropdown. 'Booking Time Period'.Value is how you read a SharePoint Choice column — if you set yours up as plain text instead, drop the .Value.

    ⚠️ Delegation warning: SharePoint is fussy with complex Filter + in + nested filter combinations. You'll likely see the blue delegation underline. If your Bookings list grows beyond 2,000 rows, you'll start missing results silently.

    The clean workaround if delegation bites you: pull the conflicting bookings into a collection first (which delegates fine on simple criteria), then check membership against the collection in your main filter:

     
     

    That keeps the heavy lifting delegable on SharePoint, then does the session logic in-memory on the (smaller) overlap set.

    Give it a try and let me know how it goes — happy to dig in if the delegation warning shows up.

  • Suggested answer
    11manish Profile Picture
    3,128 on at
    Your current approach is on the right track, but there are two important considerations:
    • Use proper date overlap logic to identify any conflicting booking.
    • Apply session-based conflict rules (Morning, Afternoon, All Day) when filtering vehicles.
    Date Overlap Logic
     
    Instead of:
    • 'Booking Start' >= DateFrom && 'Booking End' <= DateTo
    use:
    • 'Booking Start' <= DateTo && 'Booking End' >= DateFrom
    This ensures that any booking overlapping the selected date range is treated as a conflict.
     
    If possible, avoid using the vehicle registration stored in the Title field as the relationship between the two lists. Instead, create a Lookup column in the Bookings list that references the Vehicles list. This provides:
    • Better data integrity
    • Easier maintenance
    • Improved filtering and reporting
    • Fewer issues if vehicle registrations change
    Also be aware that nested Filter() and in operations against SharePoint can become non-delegable for large lists. If the number of vehicles or bookings grows
     
    significantly, you may need to redesign the query or move the data to Dataverse for better scalability.
  • Suggested answer
    BCBuizer Profile Picture
    22,831 Super User 2026 Season 1 on at
     
    The below formula should do the trick for you, assuming you have a ComboBoxSession control where the user selects the session they wish to book. You may need to tweak the formula a bit, depending on the specifics of your App and list:
     
    With(
      {
        _OverlappingBookings: Filter(
          'Bookings List',
          'Booking Start' <= DateTo,
          'Booking End' >= DateFrom,
          'Booking Time Period' = ComboBoxSession.Selected.Value || 'Booking Time Period' = "All day"
        )
      },
      Filter(
        'Vehicles List',
        Not(Title in _OverlappingBookings.Title)
      )
    )
     
     
     
    If this reply helped you in any way, please give it a Like 💜 and in case it resolved your issue, please mark it as the Verified Answer ✅.
     
     
  • Ram Prakash Duraisamy Profile Picture
    5,877 Super User 2026 Season 1 on at
     

    Use session-conflict logic:

    Morning → exclude Morning + All Day bookings

    Afternoon → exclude Afternoon + All Day bookings

    All Day → exclude Morning + Afternoon + All Day bookings

    Please mark as answer if my suggestion helps.
    Subscribe here for More Useful videos : https://www.youtube.com/@rampprakash3991

       

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 474

#1
Valantis Profile Picture

Valantis 474

#3
WarrenBelz Profile Picture

WarrenBelz 375 Most Valuable Professional

Last 30 days Overall leaderboard