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 / help with filters and ...
Power Apps
Answered

help with filters and empty fields

(0) ShareShare
ReportReport
Posted on by

say I have 3 dropdown and 1 text field.  I need to filter the data by these inputs.

 

if I do this code below, with && I get specific results, which I like, but this filters all the dropdowns regardless if they are blank/empty and does not provide good results.  If I use && and populate all the inputs it works great giving me specific results.  I tried || and this provides way too many results and they do not look accurate at all.  

I tried doing If statements inside this code to like not search one of these if they are blank/empty, but I keep getting errors.

What is my best approach to exclude searches if those fields are empty.  Should I be creating big If statements to provide the filter based on empty fields.  cause that will be a very big nested if/else I would like to avoid...

 

SortByColumns(
 Filter(
 //Filter('PSI - PROJECTS', Dropdown_region.SelectedText.Value in region.Value || Dropdown_location.SelectedText.Value in location.Value || Dropdown_l1sponsor.SelectedText.Value in l1_sponsor.Value )
 Filter('PSI - PROJECTS', Dropdown_location.SelectedText.Value in location.Value && Dropdown_l1sponsor.SelectedText.Value in l1_sponsor.Value && Dropdown_region.SelectedText.Value in region.Value)
 ,
 search_title_code.Text in Title || search_title_code.Text in project_code || search_title_code.Text in acronym
 ), 
 "Title",
 SortOrder.Descending
)
Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    156,119 Most Valuable Professional on at

    Hi @gstlouis ,

    I think this is what you are trying to do

    SortByColumns(
     Filter(
     'PSI - PROJECTS', 
     (
     Len(Dropdown_region.Selected.Value) = 0 ||
     Dropdown_region.Selected.Value in region.Value
     ) &&
     (
     Len(Dropdown_location.Selected.Value) = 0 ||
     Dropdown_location.Selected.Value in location.Value
     ) &&
     (
     Len(Dropdown_l1sponsor.Selected.Value) = 0 ||
     Dropdown_l1sponsor.Selected.Value in l1_sponsor.Value 
     ) &&
     (
     Len(search_title_code.Text) = 0 ||
     search_title_code.Text in Title || 
     search_title_code.Text in project_code || 
     search_title_code.Text in acronym
     )
     ),
     "Title",
     SortOrder.Descending
    )

     

    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

  • gstlouis Profile Picture
    on at

    Thanks for this.  It looks to be working.  So between the parenthesis creates like a ternary if stmt?  If this input = 0 nothing happens, else search input in table?

  • WarrenBelz Profile Picture
    156,119 Most Valuable Professional on at

    @gstlouis ,

    Correct - I use Len (length) as it covers both IsBlank() and IsEmpty() so Len(ControlOutput) = 0 means there is nothing in there and if this is true, no filter is applied.

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