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 / Filtering and Sorting ...
Power Apps
Answered

Filtering and Sorting SharePoint gallery with multiple criteria

(0) ShareShare
ReportReport
Posted on by 116

I have a gallery of SharePoint items that I sorting and filtering by the SharePoint ID# when a value is entered in a text input field (InputSearchID).

This formula is working like a charm.

SortByColumns( Filter( PRMaster, Len(InputSearchID.Text) = 0 || ID = Value(InputSearchID.Text) ), "ID", SortOrder.Descending ) 

I now have a requirement to filter by Title (text) and DepartmentName (list) when text is entered into a new text input field named InputSearchText

I am very new to Power Apps and am struggling to get a functional formula that includes these additional filters.

 

Any help with this is greatly appreciated.

 

Best regards,
Jayne

 

Categories:
I have the same question (0)
  • Rajkumar_M Profile Picture
    3,747 Moderator on at

    Hi @JayneButton 

     

    Try this formula,

     

    SortByColumns(
    Filter(
    PRMaster,
    (Len(InputSearchID.Text) = 0 || ID = Value(InputSearchID.Text)) &&
    (Len(InputSearchText.Text) = 0 || StartsWith(Title, InputSearchText.Text)) &&
    (Len(InputSearchText.Text) = 0 || DepartmentName.Value = InputSearchText.Text)
    ),
    "ID",
    SortOrder.Descending
    )

    (Or)

     

    SortByColumns( 
    Filter(
    PRMaster, (Len(InputSearchID.Text) = 0 ||
    ID = Value(InputSearchID.Text)) && (Len(InputSearchText.Text) = 0 ||
    Title = InputSearchText.Text || DepartmentName.Value = InputSearchText.Text) ),
    "ID",
    SortOrder.Descending
    )
     

    Thanks!

     

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

     

  • JayneButton Profile Picture
    116 on at

    Hello @Rajkumar_404 

     

    I have tried both formulas and when typing in InputSearchID it works great.

    When typing in InputSearchText I receive no results from Title or DepartmentName.

  • Verified answer
    Rajkumar_M Profile Picture
    3,747 Moderator on at

    @JayneButton 

     

    Try this formula,

     

    SortByColumns(
    Filter(
    PRMaster,
    (Len(InputSearchID.Text) = 0 || ID = Value(InputSearchID.Text)) &&
    (Len(InputSearchText.Text) = 0 || StartsWith(Title, InputSearchText.Text)) &&
    (Len(InputSearchText.Text) = 0 || StartsWith(DepartmentName.Value, InputSearchText.Text))
    ),
    "ID",
    SortOrder.Descending
    )

    (Or)

     

    SortByColumns(
    Filter(
    PRMaster,
    (Len(InputSearchID.Text) = 0 || ID = Value(InputSearchID.Text)) &&
    (Len(InputSearchText.Text) = 0 || InputSearchText.Text in Title) &&
    (Len(InputSearchText.Text) = 0 || InputSearchText.Text in DepartmentName.Value)
    ),
    "ID",
    SortOrder.Descending

     

    Thanks!

     

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

     

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 345 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 177

Last 30 days Overall leaderboard