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 / Distinct and sort valu...
Power Apps
Answered

Distinct and sort values from a SP multiselect choice column

(1) ShareShare
ReportReport
Posted on by 23
Hello
 
I'm trying to use the below code to give me values that I can select in a combo box. The Credential Domain(s) column is from a SP multiselect choice field, and has now been pulled into a collection in my app.
Sort(Distinct(colCredentials,'Credential Domain(s)'.Value),SortOrder.Descending)
The formula is not sowing any errors, but I'm also not seeing any values appear in my combo box either.
 
Any help would be greatly appreciated :)
Categories:
I have the same question (0)
  • SoPatt Profile Picture
    Microsoft Employee on at
    Looking at the documentation for the Sort function from Sort and SortByColumns functions - Power Platform | Microsoft Learn, I see "Sort( Table, Formula [, SortOrder ] )"
     
    What you have is two arguments to Sort, where one is a single-column table (because that's what Distinct returns), and the second is a SortOrder. So that doesn't match what the Sort function is expecting.
     
    Possibly you want:
    Sort(Distinct(colCredentials,'Credential Domain(s)'.Value),Value,SortOrder.Descending)
    If not, perhaps you could share some sample data of what is in colCredentials or what Distinct() is returning.
  • jauntysever Profile Picture
    23 on at
    Hi SoPatt
     
    I tried that approach and still get an error - 
     
    "The expression was intended to sort the distinct values of the 'Value' column in the 'colCredentials' table in descending order. However, the errors in the expression are that the 'Sort' function cannot sort on the expression type, and there are invalid arguments provided to the 'Sort' function."
  • mstavra Profile Picture
    247 on at
     I don't think that Distinct works on a multi select choice field. I would propose to create a 2nd combo box with single select values and test your formula. If it works you need to find a way to export the multi values in order to be taken as if there are singe values.
     
    I hope this makes sense :)
  • Verified answer
    jauntysever Profile Picture
    23 on at
    In the end I was able to get the values using this
     
    Distinct(
        Filter(
            Split(
                Concat(
                    ForAll(
                        colCredentials,
                        Concat(
                            'Credential Domain(s)',
                            Value & ";"
                        )
                    ),
                    Value & ";"
                ),
                ";"
            ),
            Len(Value) > 0
        ),
        Value
    )
     

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard