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 / Sort values in Combo box
Power Apps
Answered

Sort values in Combo box

(0) ShareShare
ReportReport
Posted on by 559

Hi All,

I have a Combo box which gets values of a column in SharePoint. I am using a with function to get the values from SharePoint which is getting displayed properly. But the values in the Combo box are not sorted alphabetically.

The code in the item's property is:

With (
{
Items: Ungroup (
For All (
Customer Accounts,
'Account Manager'
),
"Value"
),
Distinct Email: Distinct(
Ungroup (
For All (
Customer Accounts,
'Account Manager'
),
"Value"
),
Email
)
},
Sort(
For All (
Distinct Email,
First (
Filter(
Items,
Email = Result
)
)
),
!IsBlank(DisplayName)
)
)

 

Any help on this would be greatly appreciated.

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    154,424 Most Valuable Professional on at

    Hi @Uthhra ,

    I cannot get the code you posted to validate, however if you are wanting the Distinct values of the (I assume) Person field 'Account Manager' in the List CustomerAccounts, with the two fields of Item and Email, this should do and Sort as well

    Sort(
     AddColumns(
     RenameColumns(
     GroupBy(
     AddColumns(
     CustomerAccounts,
     "EmailAdd",
     'Account Manager'.Email,
     "Staff",
     'Account Manager'.DisplayName
     ),
     "EmailAdd",
     "Data"
     ),
     "EmailAdd",
     "Email"
     ),
     "Item",
     First(Data).Staff
     ),
     Item
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Sri Profile Picture
    559 on at

    Hi @WarrenBelz ,

    I tried applying the above code and got error Sort has invalid arguments. Account Manager is a person or group field in SharePoint which allows multiple selections. I have a shared a screenshot of the error.

    Screenshot (87).png
    Screenshot (86).png
  • WarrenBelz Profile Picture
    154,424 Most Valuable Professional on at

    Hi @Uthhra ,

    OK - it would have been good to mention that - try this

    With(
     {
     Items: 
     Ungroup (
     ForAll (
     'Customer Accounts',
     'Account Manager'
     ),
     "Value"
     )
     },
     With(
     {
     DistinctEmail: 
     Distinct(
     Items,
     Email
     )
     },
     Sort(
     ForAll(
     DistinctEmail,
     LookUp(
     Items,
     Email = Result
     )
     ),
     DisplayName
     )
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Sri Profile Picture
    559 on at

    Hi @WarrenBelz ,

     Thanks a lot. It worked perfectly. But I am getting a Blank value at the end.

  • Verified answer
    WarrenBelz Profile Picture
    154,424 Most Valuable Professional on at

    @Uthhra ,

    If that really matters, do this

    With(
     {
     Items: 
     Ungroup (
     ForAll (
     'Customer Accounts',
     'Account Manager'
     ),
     "Value"
     )
     },
     With(
     {
     DistinctEmail: 
     Distinct(
     Items,
     Email
     )
     },
     Sort(
     Filter(
     ForAll(
     DistinctEmail,
     LookUp(
     Items,
     Email = Result
     )
     ),
     !IsBlank(DisplayName)
     ),
     DisplayName
     )
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Sri Profile Picture
    559 on at

    Hi @WarrenBelz,

    It worked perfectly. Thank you so much.

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!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 103

#2
WarrenBelz Profile Picture

WarrenBelz 82 Most Valuable Professional

#3
wolenberg_ Profile Picture

wolenberg_ 67 Super User 2026 Season 1

Last 30 days Overall leaderboard