cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lewkir
Resolver I
Resolver I

Filtering with Multiple Or statements

Hi,

 

I'm trying to Filter a Sharepoint List of Bookings based on whether the start and finish time of each booking falls within a time already booked. The times are stored as number values in the format: YYYYMMDDhhmm.

 

Filter(
                'Booking List',
                (FromCalcFlow < Value(FromDateAsNumber.Text) &&  
                ToCalcFlow >= Value(FromDateAsNumber.Text))  //Checks if start time is outside selected dates and end time within them
Or 
                (FromCalcFlow > Value(FromDateAsNumber.Text) &&
                FromCalcFlow < Value(ToDateAsNumber.Text) &&
                ToCalcFlow > Value(FromDateAsNumber.Text) &&
                ToCalcFlow < Value(ToDateAsNumber.Text)) Checks if Both start time end time is within selected dates 
Or
                (FromCalcFlow >= Value(ToDateAsNumber.Text) &&  
                ToCalcFlow > Value(ToDateAsNumber.Text))) //Checks if start time is inside selected dates and end time outside them

The problem is powerapps seems to ignore the first two conditions and only evaluate for the ToCalcFlow > Value(ToDateAsNumber.Text part of the 3rd.

 

Meaning it only returns bookings that have a To date later than both selected dates.

 

Is there a way to make it evaluate them all?

 

Cheers,

1 ACCEPTED SOLUTION

Accepted Solutions
Lewkir
Resolver I
Resolver I

Figured it out a > was the wrong way round.

Filter(
                'Booking List',
                (FromCalcFlow < Value(FromDateAsNumber.Text) &&   
                ToCalcFlow >= Value(FromDateAsNumber.Text)) Or 
                (FromCalcFlow > Value(FromDateAsNumber.Text) &&
                FromCalcFlow < Value(ToDateAsNumber.Text) &&
                ToCalcFlow > Value(FromDateAsNumber.Text) &&
                ToCalcFlow < Value(ToDateAsNumber.Text)) Or
                (FromCalcFlow <= Value(ToDateAsNumber.Text) &&  
                ToCalcFlow > Value(ToDateAsNumber.Text))
      )

View solution in original post

1 REPLY 1
Lewkir
Resolver I
Resolver I

Figured it out a > was the wrong way round.

Filter(
                'Booking List',
                (FromCalcFlow < Value(FromDateAsNumber.Text) &&   
                ToCalcFlow >= Value(FromDateAsNumber.Text)) Or 
                (FromCalcFlow > Value(FromDateAsNumber.Text) &&
                FromCalcFlow < Value(ToDateAsNumber.Text) &&
                ToCalcFlow > Value(FromDateAsNumber.Text) &&
                ToCalcFlow < Value(ToDateAsNumber.Text)) Or
                (FromCalcFlow <= Value(ToDateAsNumber.Text) &&  
                ToCalcFlow > Value(ToDateAsNumber.Text))
      )

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,431)