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
Answered

Set sort order

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi

 

I'm sure this is really easy but i can't make it work. I would like to set the sort order of this query.

 

Filter(GroupBy(Filter('Support log',spgSupportStage="IP"||spgSupportStage="Drafting an IP (notify EPO)"||spgSupportStage="Identifying & clarifying support needs"||spgSupportStage="Preliminary Advice re: significant concerns (notify EPO)"),"spgSupportStage","SchoolGrouping"),TextSearchBox1_1.Text in spgSupportStage)

 

The order needs to be 

IP

Drafting an IP

Preliminary Advice

Identifying and Clarifying

 

How would i go about doing that?

 

Thank you heaps.

 

Categories:
  • v-zhta-msft Profile Picture
    Microsoft Employee on at

    Case link:

    https://powerusers.microsoft.com/t5/General-Discussion/Set-sort-order/m-p/150273#M51188

     

    Hi @ JoelHj,

     

    Maybe you can use the SortByColumns function in your formula.

     

    In addition to sorting ascending or descending, SortByColumns can sort based on a single column table of values. For example, you can sort record based on the name of a day of the week by supplying [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ] as the sort order. All records which have Monday" will come first, followed by Tuesday, and so on. Records found that do not appear in the sort table are put at the end of the list.

     

    Here is the link of SortByClolumns :

     

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

     

    Hope this helps you.

     

    Best regards,

    Zheng

  • v-zhta-msft Profile Picture
    Microsoft Employee on at

    Hi @ JoelHj,

     

    Maybe you can use the SortByColumns function in your formula.

     

    In addition to sorting ascending or descending, SortByColumns can sort based on a single column table of values. For example, you can sort record based on the name of a day of the week by supplying [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ] as the sort order. All records which have Monday" will come first, followed by Tuesday, and so on. Records found that do not appear in the sort table are put at the end of the list.

     

    Here is the link of SortByClolumns :

     

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

     

    Hope this helps you.

     

    Best regards,

    Zheng

  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @Anonymous,

    You would wraip your entire expression using the SortByColumns() function. Column names must be strings and enclosed in double quotes followed by a comma then the direction of the sort.

    SortByColumns(Filter(GroupBy(Filter('Support log',spgSupportStage="IP"||spgSupportStage="Drafting an IP (notify EPO)"||spgSupportStage="Identifying & clarifying support needs"||spgSupportStage="Preliminary Advice re: significant concerns (notify EPO)"),"spgSupportStage","SchoolGrouping"),TextSearchBox1_1.Text in spgSupportStage), "IP",Ascending,"Drafting an IP",Ascending,"Preliminary Advice",Ascending, "Identifying and Clarifying",Ascending).  Check out the SortByColumns() function on 

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-sort  for more details.  Good luck.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    i Called out to early. I actually get an error saying that the 

    "IP",Ascending and so on are not columns. The only column the app accepts is the source 

    spgSupportStage and not 

    spgSupportStage="IP"

     

     

  • v-zhta-msft Profile Picture
    Microsoft Employee on at

    Hi @ JoelHj,

     

    Maybe you can use the SortByColumns function in your formula.

     

    In addition to sorting ascending or descending, SortByColumns can sort based on a single column table of values. For example, you can sort record based on the name of a day of the week by supplying [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ] as the sort order. All records which have Monday" will come first, followed by Tuesday, and so on. Records found that do not appear in the sort table are put at the end of the list.

     

    Here is the link of SortByClolumns :

     

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

     

    Hope this helps you.

     

    Best regards,

    Zheng

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    HI

     

    Thank you for this and when i do use the names as you say it filters and gives me results but it doesn't change the group sections in the order i want. I have taken screen shots for you. The grey "goup" sections are the ones I'm trying to change the order of. When is do try fifferent sorting the data in the second gallery changes but not the grouped sections. 

     

    These screen shots are taken with this query

    Filter(GroupBy(SortByColumns(Filter('Support log',spgSupportStage="IP"||spgSupportStage="Drafting an IP (notify EPO)"||spgSupportStage="Identifying & clarifying support needs"||spgSupportStage="Preliminary Advice re: significant concerns (notify EPO)"),"spgSupportStage","IP"),"spgSupportStage","SchoolGrouping"),TextSearchBox1_1.Text in spgSupportStage)

     

     

    Image2.png
    Image.png
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Just wanted to come back and show you what we ended up with. Its not the most efficient code and I will be looking at refining it but this works for now.

     

    SortByColumns(Filter(GroupBy(Filter('Case Management',spgCaseStatus.Value="Active"||spgSupportStage="IP"||spgSupportStage="Drafting an IP (notify EPO)"||spgSupportStage="Identifying & clarifying support needs"||spgSupportStage="Preliminary Advice re: significant concerns (notify EPO)"),"spgSupportStage","SchoolGrouping"),TextSearchBox1_1.Text in spgSupportStage),"spgSupportStage",["IP","Drafting an IP (notify EPO)","Preliminary Advice re: significant concerns (notify EPO)"])

  • seadude Profile Picture
    1,855 on at

    Thanks @Anonymous and @v-zhta-msft for the tip on custom SortByColumns using [ ] !

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 232 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 202 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard