web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter Gallery by Last...
Power Apps
Unanswered

Filter Gallery by Last Name A - Z

(0) ShareShare
ReportReport
Posted on by 5,325 Super User 2025 Season 2

I have a Gallery that I am filtering using the following. There are some 600 items in the list, and I am filtering out 271 of them to display in the Gallery.

I am trying to get the items to show in A - Z order. Of the 271 items the first 220 appear in alphabetical order starting with 'C', by last name. The last fifty start again with the last names that start with 'A'. These 'A' names should be at the top of the Gallery.

Gallery1 items -

     If(IsBlank(Name_Search_Fld.Text), Filter(DataCollection, PersonType="Teacher", Region = "North", Basis = "1",
     FirstName,SortOrder.Descending),

     Filter(DataCollection,FirstName=Name_Search_Fld.Text, Region = "North",Basis = "1",FirstName,SortOrder.Descending))

Categories:
I have the same question (0)
  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @Phineas,

     

    You are currently filtering your gallery by first name descendingly (z - a). You will have to change this for both Filters to the Last Name column and SortOrder.Ascending.

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • Verified answer
    timl Profile Picture
    36,383 Super User 2025 Season 2 on at

    Hi @Phineas 

    In addition to what @LaurensM says, you're also missing the actual call to the Sort function.

     

    If(
     IsBlank(Name_Search_Fld.Text),
     Sort(Filter(
     DataCollection,
     PersonType = "Teacher",
     Region = "North",
     Basis = "1")
     FirstName,
     SortOrder.Ascending
     ),
     Sort(Filter(
     DataCollection,
     FirstName = Name_Search_Fld.Text,
     Region = "North",
     Basis = "1")
     FirstName,
     SortOrder.Ascending
     )
    )
    

     

  • Phineas Profile Picture
    5,325 Super User 2025 Season 2 on at

    How do I squeeze in a StartsWith for the lower 'search' function, so that the Gallery populates when the first letter is typed into the search box, rather than having to wait for the entire name to be entered?

  • Verified answer
    Phineas Profile Picture
    5,325 Super User 2025 Season 2 on at

    I messed around and accidently stumbled over my answer.

    If(IsBlank(Name_Search_Fld.Text),
    Sort(Filter(
    DataCollection,
    PositionType="Teacher",
    Region = "North",
    Basis = "1"),
    FirstName,
    SortOrder.Ascending
    ),

    Sort(Filter(DataCollection,
    StartsWith(FirstName,Name_Search_Fld.Text),
    PositionType = "Teacher",
    Region = "North",
    Basis = "1"),SortOrder.Ascending
    ))

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard