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 / Need help on improve t...
Power Apps
Unanswered

Need help on improve the formula syntax

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a working formula. The formula is to compare two collection "Booking" and "colResult":

 

 

If(CountRows(colResult) >0,
Filter(
Booking,
(ResourceName in colResult.ResourceName) &&
(StartTime <= bookStartTime && EndTime >= bookEndTime)
),
Filter(Booking,1=0))

 

 

When colResult have 0 row, ResourceName in colResult.ResourceName is always true. Hence entire Booking is returned. 

To avoid this situation I add the first line and last line. It looks ugly but I cannot find a better way. Could you please advise?

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    Yes, try to avoid using If statements in your Items formulas!

    Include your logic in the criteria logic statement.

     

    Filter(Booking,
     CountRows(colResult) = 0 ||
     ((ResourceName in colResult.ResourceName) &&
     (StartTime <= bookStartTime && EndTime >= bookEndTime)
     )
    )

     

    I hope this is helpful for you.

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

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 326 Most Valuable Professional

#2
11manish Profile Picture

11manish 168

#3
sannavajjala87 Profile Picture

sannavajjala87 75 Super User 2026 Season 1

Last 30 days Overall leaderboard