Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Custom sort order from lookup column

(0) ShareShare
ReportReport
Posted on by 199

Hi everyone! I have 2 SharePoint lists: List1-with the main data and  List2- with the list of countries. I created a Lookup column in List1 connecting with List2. 

I was wondering if is there a way to custom-sort the list of countries in the PowerApp, for example, UK and USA at the top of the list, and the remaining countries keep in alphabetic order. 

 

At the moment all countries are listed in alphabetic order.question about custom sort countries.jpg

  • batmanMon Profile Picture
    199 on at
    Re: Custom sort order from lookup column

    Thank you @Rutu01 !😊

  • turnerj3 Profile Picture
    2,039 on at
    Re: Custom sort order from lookup column

    SortByColumns will let you put the 2 up front.

    SortByColumns( YourList,"{YourColumn}",["UK","USA",SortOrder.Descending] )

  • Verified answer
    Rutu01 Profile Picture
    305 on at
    Re: Custom sort order from lookup column

    You could add a switch expression to perhaps have a top 10 list and then the remaining will be sorted alphabetically 

     

     

    Sort(["UK","New Zealand","Australia"],Switch(Value,"UK","0","Australia","1",Value))

     

    Or 

     

    SortByColumns(AddColumns(["Italy","UK", "Australia","Denmark"] As Countries, "CustomSortOrder",LookUp([{SortOrder:"1",Country:"UK"}], Country=Countries.Value).SortOrder),"CustomSortOrder",SortOrder.Ascending,"Value")

     

    Rutu01_1-1684857878786.png

     

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,618 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,957 Most Valuable Professional

Leaderboard