Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 7qRqO0nulIt0MPhepo/c+R
Power Apps - Building Power Apps
Answered

How can I sort this combo box alphabetically?

Like (0) ShareShare
ReportReport
Posted on 2 Mar 2023 09:22:15 by 28

Hi,

 

I have two combo boxes that allow you to select company or department that link up to a gallery. The combo boxes use this function:

 

 

Distinct(
 Office365Users.SearchUser({searchTerm: ""}).CompanyName,
 CompanyName
)

 

 

It shows all the companies but not in alphabetical order. They seem to be in the order that they appear in the gallery. Is it possible to change the order to alphabetical?

 

Thanks.

  • Verified answer
    AlexJD Profile Picture
    28 on 02 Mar 2023 at 10:22:28
    Re: How can I sort this combo box alphabetically?

    So close but didn't work. Switch out "Sort" for "SortByColumns" and it worked:

     

    SortByColumns(
     Distinct(
     Office365Users.SearchUser({searchTerm: ""}).Department,
     Department
     ),
     "Result"
    )
  • timl Profile Picture
    34,998 Super User 2025 Season 1 on 02 Mar 2023 at 09:36:21
    Re: How can I sort this combo box alphabetically?

    Hi @AlexJD 

    This will sort the results:

     

    Sort(
     Distinct(
     Office365Users.SearchUser({searchTerm: ""}).CompanyName,
     CompanyName
     ),
     Result
    )

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
MS.Ragavendar Profile Picture

MS.Ragavendar 32

#2
Rajkumar_M Profile Picture

Rajkumar_M 16 Super User 2025 Season 1

#2
mmbr1606 Profile Picture

mmbr1606 16 Super User 2025 Season 1

Overall leaderboard
Loading started