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 / Multiple If functions ...
Power Apps
Answered

Multiple If functions and Filters

(0) ShareShare
ReportReport
Posted on by 21

Good Afternoon

 

I have a Power app that enables users to book vehicles by date I have a request to enable users to split the booking by either morning or afternoon, but also for the whole day.

 

In my gallery filter (of the available vehicles 'CT Fleet List') I've added an extra condition (underlined in bold below), Where "Time" is a Choice column in my SharePoint list of bookings 'CT Fleet Reservations' with the three choices "Morning, Afternoon, All Day" and DropdownTime is the dropdown, see screen grab

 

DavidRyan_1-1714054749139.png

 

 

Filter(
'CT Fleet List',
!(
Title in Filter(
'CT Fleet Reservations',
('Check Out from' >=DateFrom && 'Check Out from' <= DateTo) ||
('Check Out to' >=DateFrom && 'Check Out to' <= DateTo) || (Time.Value = DropdownTime.Selected.Value)
).Title
)
)

 

Although the filter works fine for individual choices it doesn't filter the necessary combinations.

 

So I think the filters need to work as follows

 

If Morning  chosen then don't display any choices where Afternoon or All Day were selected

If Afternoon chosen then don't display any choices where Morning or All Day were selected

If All Day chosen then don't display any choices where any of the options where selected

 

But I can't work out how to write the If function to get the filter to work (alongside the dates)

 

Any suggestions

 

Regards 

 

David  

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    154,924 Most Valuable Professional on at

    Hi @DavidRyan ,

    Your main issue is that you have filtered out all the relevant records for the days concerned, so you do not have anything left to apply additional criteria to after that filter. Below is a "best effort concept"- if it (or a variation of it) does not work, I do not believe you can do it. Note you also need an additional filter to cover bookings spanning the entire period.

    Filter(
     'CT Fleet List',
     !(
     Title in 
     Filter(
     'CT Fleet Reservations',
     (
     (
     'Check Out from' >=DateFrom && 
     'Check Out from' <= DateTo &&
     (
     DropdownTime.Selected.Value = "All Day" ||
     Time.Value = DropdownTime.Selected.Value
     )
     ) ||
     (
     'Check Out to' >=DateFrom && 
     'Check Out to' <= DateTo &&
     (
     DropdownTime.Selected.Value = "All Day" ||
     Time.Value = DropdownTime.Selected.Value
     )
     ) || 
     (
     'Check Out from' <=DateFrom && 
     'Check Out to' >= DateTo &&
     (
     DropdownTime.Selected.Value = "All Day" ||
     Time.Value = DropdownTime.Selected.Value
     )
     )
     )
     ).Title
     )
    )

     

    Please click Accept as solution 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 giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • DavidRyan Profile Picture
    21 on at

    Thank you, apologies for the delay in responding.

     

    There was a partial success

     

    Below is screen shot from the SharePoint list.

     

    The filtering worked when you booked the vehicle for either the Morning or Afternoon as per 4th and 5th, so that if you tried to book a vehicle for All Day on either of those days, BT71 AAF did not appear in the available vehicle gallery, however if you wanted a vehicle just for the Morning or Afternoon it would appear on the relevant day (i.e. available in the afternoon on the 4th and vice versa) However as you can see I was able to book the vehicle twice on the 3rd which shouldn't happen. Is that what you mean by "you also need an additional filter to cover bookings spanning the entire period."?

     

    DavidRyan_0-1714636717545.png

     

     

  • WarrenBelz Profile Picture
    154,924 Most Valuable Professional on at

    Hi @DavidRyan ,
    As I noted - "best effort". The problem is that your "primary" filter on the dates takes out all the relevant records, so if you tried to filter that, you would have no data to filter on the "half days". I tried to incorporate a "sub filter" on each set, but I suspect you booked the morning first, which then allowed the "All Day". I really cannot do much more on this without building a model and testing.

  • Verified answer
    DavidRyan Profile Picture
    21 on at

    Thanks for your help. 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 534

#2
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 306

Last 30 days Overall leaderboard