cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lewkir
Level: Powered On

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
Highlighted
Lewkir
Level: Powered On

Re: Filtering with Multiple Or statements

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
Highlighted
Lewkir
Level: Powered On

Re: Filtering with Multiple Or statements

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
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 174 members 3,093 guests
Please welcome our newest community members: