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 Apps
Unanswered

sort with distinct

(0) ShareShare
ReportReport
Posted on by

Is it possible to combine in one function DISTINCT and SORT? And how can it be possible to create a Collection using distinct?

Categories:
  • Brian Dang Profile Picture
    3,976 on at

    You would have to nest it. 

     

    The Items property of a gallery or dropdown would look like:

    Sort(Distinct(datasource,column to find distinct records), column for sorting, ascending/descending)

     

    You would collect what you want and the formula above would sort it after the fact.

     

    That said, with the April 29 update to PowerApps, your datasource may not load entirely if you use both of those functions together since they have worked in "delegation."

  • TerjeF Profile Picture
    108 on at

    I tried a lot, and come to this:

    Sort(Distinct(Source,Column),Result)

  • bean Profile Picture
    568 on at

    Sort(Distinct(Source,Column),Result) - Worked good for me. I additionally added the if statement  to switch the order.

     

    Sort(Distinct(Source,Column),Result,If(SortDescending1, Ascending,Descending))

     

    Thanks!

  • EdHansberry Profile Picture
    386 on at

    Where is the documentation for this? I cannot find how I should have known "Result" would just allow it to sort the column I performed the Distinct() operation on. It would not work with the column name. Required "Result" to be there.

  • mdevaney Profile Picture
    29,993 Moderator on at

    @EdHansberry 

    I found it in the 3rd sentence of the Distinct function documentation highlighted in bold  😋  In my opinion though it should just be in a column called value like everything else.  Why can't life be simple?

     

    Link to Distinct function documentation

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-distinct

     

     

    Screenshot:

     

    Untitled.png

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • EdHansberry Profile Picture
    386 on at

    Thank you! I was looking in the SORT documentation. 

  • mdevaney Profile Picture
    29,993 Moderator on at

    @EdHansberry 

    Ahhhhhh. That's why.  I understand now.  I think there's a few other functions that behave this way.  Split and Concatenate are two examples.  I can't recall if there's any others at this moment.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."  

     

     

  • dnorena Profile Picture
    4 on at

    For me the way that works is:

    Distinct(Sort(Filter('Source';true).Column;Column;Ascending);Column)

  • gatafish Profile Picture
    6 on at

    Nice, hadn't tried the Result. Thank You

  • Digital Profile Picture
    1,207 on at

    @mdevaney , I agree. Why do they use Result and not Value? I've often found myself using RenameColumns to make it consistent.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 312

#3
Mohsin Ali Profile Picture

Mohsin Ali 252

Last 30 days Overall leaderboard