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))
      )

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,077)