Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building 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 :)
  • Verified answer
    jauntysever Profile Picture
    23 on at
    Distinct and sort values from a SP multiselect choice column
    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
    )
     
  • mstavra Profile Picture
    247 on at
    Distinct and sort values from a SP multiselect choice column
     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 :)
  • jauntysever Profile Picture
    23 on at
    Distinct and sort values from a SP multiselect choice column
    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."
  • SoPatt Profile Picture
    Microsoft Employee on at
    Distinct and sort values from a SP multiselect choice column
    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.

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 770 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 494

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 399