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 / PowerApps - Sort and F...
Power Apps
Answered

PowerApps - Sort and Filter Galleries

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

So I have the gallery before and I Want to sort Ascending/descending by the Employees Name (which is the Author column in SharePoint) but when i press the sort button, this is what happens:

SLCLARKE_0-1642169367858.png

Also for the search, i want to be able to type persons name in and it filters for them but that also doesn't work.

 

This is the formula:

 

SortByColumns(Filter([@'Compliance Team Leave Requests'],StartsWith('Title',TextSearchBox1.Text)), "Title", If(SortDescending1, Descending, Ascending))

 

Any ideas?

 

SLCLARKE_1-1642169476108.png

 

Categories:
I have the same question (0)
  • Verified answer
    VeGETzX Profile Picture
    367 on at

    You must specify which column to search with your StartsWith function, and the Author column is a person column that contains all of the author including DisplayName, Email, etc. In this case you want to search by Author DisplayName, so use 'Author.DisplayName'.

     

    And, for SortByColumns to work, you must replace "Title" with the column you want to use for sorting (Author.DisplayName), but you cannot use "Author.DisplayName." This is where AddColumns comes in; it will extract the Author.DisplayName from the person column and stored it in a new column called "AuthorDisplayName," which you can use for sorting.

     

    Try put this code into Items property of your gallery.

     

    SortByColumns(
     Filter(
     AddColumns(
     [@'Compliance Team Leave Requests'],
     "AuthorName",
     Author.DisplayName
     ),
     StartsWith(
     Author.DisplayName,
     TextSearchBox1.Text
     )
     ),
     "AuthorName",
     If(
     SortDescending1,
     Descending,
     Ascending
     )
    )

     

     

     

  • rubin_boer Profile Picture
    4,843 Super User 2024 Season 1 on at

    hi @Anonymous your function is sorting "Title" and not author hence the sequence you have, based on the title being annual leave and TOIL. replacing the title with author as per @VeGETzX it will sort as you want it to. the Author.DisplayName  being the 'Employee Name'.DisplayName

  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

    Could you please tell me that if you want to search and sort by the 'Name of Employee' column in your list?

     

    The StartsWith() function you provided should reference to the 'Name of Employee' column directly as below:

    SortByColumns(AddColumns(Filter([@'Compliance Team Leave Requests'],StartsWith('Name od Employee'.DisplayName,TextSearchBox1.Text)),"EmployeeName",'Name od Employee'.DisplayName), "EmployeeName", If(SortDescending1, Descending, Ascending))

    You should know that a Person column could not be supported in SortByColumns() function, so I add a temporary text column instead.

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

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard