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 / Filter Gallery by Last...
Power Apps
Answered

Filter Gallery by Last Name A - Z

(0) ShareShare
ReportReport
Posted on by 5,331 Moderator

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
    37,152 Super User 2026 Season 1 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,331 Moderator 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,331 Moderator 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 834

#2
Valantis Profile Picture

Valantis 533

#3
Haque Profile Picture

Haque 410

Last 30 days Overall leaderboard