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 / Sort a distincted colu...
Power Apps
Unanswered

Sort a distincted column based on another column values

(0) ShareShare
ReportReport
Posted on by 67

Dear Power apps experts,

 

I have created an App using a gallary which is connected to SP list as "data source".

I am trying to create a combobox and combaine two functions (Distinct and sort) but not successed yet.

 

The combobox supposes to show a list of values from a column in the data source (table from SP). The values must be sorted based on another column. For instance, If we suppose that we have two columns on SP list, column A and B. I what is want to do is, to connect the comobobox to column A as dropdown list and to be sorted (Descending) based on column B. 

A (Serie nr)B (ID)
105
74
53
112
31

With other word, I want to create the combobox to have the dropdown list A (Serie nr) and sorted on B (ID), however; the dropdown list should show the results as folowing:

A (Serie nr)
3
11
5
7
10

 

I would appreciate your help.

 

BR

Categories:
I have the same question (0)
  • Verified answer
    developerAJ Profile Picture
    4,628 on at
    Distinct(SortByColumns(DataSource,"ColumnB",SortOrder.Descending),ColumnA)

     

    Try this Out

     

    Please click Accept as solution and Thumbs Up. 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.

  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @Appsforourlife ,

     

    My first try would be to use GroupBy instead of Distinct so the rest of the data is preserved and can be used for sorting:

     

    Sort(
    	AddColumns(
    		GroupBy(
    			DataSourceName,
    			"ColumnA",
    			"GroupedByA"
    		),
    		"SortOrder",
    		First(GroupedByA).ColumnB
    	),
    	SortOrder
    )

     

  • Appsforourlife Profile Picture
    67 on at

    It worked very well!

    Thank you a lot, very apprecieted 🙏

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard