Showing results for 
Search instead for 
Did you mean: 
New Member

sort with distinct

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

Community Champion
Community Champion

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."

Microsoft Employee
Advocate III
Advocate III

I tried a lot, and come to this:


Continued Contributor
Continued Contributor

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))



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.


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







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."

Thank you! I was looking in the SORT documentation. 


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."  



New Member

For me the way that works is:


Frequent Visitor

Nice, hadn't tried the Result. Thank You

Helpful resources

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.


New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (2,174)