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 Platform Community / Forums / Power Apps / Create multiple sortin...
Power Apps
Unanswered

Create multiple sorting icons for single gallery

(0) ShareShare
ReportReport
Posted on by

Hello,

 

I have added an icon for sorting a gallery by column "SortByColumns" but want to add another for another column but having trouble with the formula. Below is what I have so far. How would I add the second "SortByColumns" for second icon?

 

I would like to add another icon for "SortByColumns" for "Customer".

 

SortByColumns(Filter(Search(LIST01, SearchBox.Text, "E_x002d_mail", "Customer", "LISTRMA_x0023_", "Contact"), If(Dropdown1.Selected.Value = "All", true, Status.Value = Dropdown1.Selected.Value), If(Dropdown2.Selected.Value = "All", true, Branch.Value = Dropdown2.Selected.Value)), "LISTRMA_x0023_", If(SortDescending1, Descending, Ascending))

 

Thanks in advance.

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,434 Most Valuable Professional on at

    Hi @ShadowTech ,

    If you set the second icon to toggle

    UpdateContext({SortDescending2:!SortDescending2})

    you could do this

    SortByColumns(
     Filter(
     Search(
     LIST01, 
     SearchBox.Text, 
     "E_x002d_mail", 
     "Customer", 
     "LISTRMA_x0023_", 
     "Contact"
     ), 
     If(
     Dropdown1.Selected.Value = "All", 
     true, 
     Status.Value = Dropdown1.Selected.Value
     ), 
     If(
     Dropdown2.Selected.Value = "All", 
     true, 
     Branch.Value = Dropdown2.Selected.Value
     )
     ), 
     "LISTRMA_x0023_", 
     If(
     SortDescending1, 
     Descending, 
     Ascending
     ),
     "Customer",
     If(
     SortDescending2, 
     Descending, 
     Ascending
     )
    )

     

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

     

  • ShadowTech Profile Picture
    on at

    @WarrenBelz 

     

    Tried that same implementation but for some reason the second sort button does not execute that function. Nothing happens when clicking the second sort button. Just the first sort button works.

     

    Any ideas?

     

    Thanks.

  • WarrenBelz Profile Picture
    156,434 Most Valuable Professional on at

    Hi @ShadowTech ,

    Strange, but I have not tried that before, so try this

    Sort(
     Sort(
     Filter(
     Search(
     LIST01, 
     SearchBox.Text, 
     "E_x002d_mail", 
     "Customer", 
     "LISTRMA_x0023_", 
     "Contact"
     ), 
     If(
     Dropdown1.Selected.Value = "All", 
     true, 
     Status.Value = Dropdown1.Selected.Value
     ), 
     If(
     Dropdown2.Selected.Value = "All", 
     true, 
     Branch.Value = Dropdown2.Selected.Value
     )
     ), 
     LISTRMA_x0023_, 
     If(
     SortDescending1, 
     Descending, 
     Ascending
     )
     ),
     Customer,
     If(
     SortDescending2, 
     Descending, 
     Ascending
     )
    )

     

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

  • ShadowTech Profile Picture
    on at

    @WarrenBelz Yeah that doesn't work. Using "SortByColumns(SortByColumns(" doesn't work either.

  • WarrenBelz Profile Picture
    156,434 Most Valuable Professional on at

    @ShadowTech ,

    The syntax structure should be valid - what do you mean by "it does not work" - does the code produce an error?

    Also note that this will sort by LISTRMA_x0023_ and then Customer - do want to sort by one or the other ? If so you need another structure with a value (say radio control) with Items ["Customer", "ListRMA"] and would look something like this (and you can go with a single sort button).

    Sort(
     Filter(
     Search(
     LIST01, 
     SearchBox.Text, 
     "E_x002d_mail", 
     "Customer", 
     "LISTRMA_x0023_", 
     "Contact"
     ), 
     If(
     Dropdown1.Selected.Value = "All", 
     true, 
     Status.Value = Dropdown1.Selected.Value
     ) &&
     If(
     Dropdown2.Selected.Value = "All", 
     true, 
     Branch.Value = Dropdown2.Selected.Value
     )
     ), 
     If(
     YourRadio.Selected.Value="Customer",
     Customer, 
     LISTRMA_x0023_
     ), 
     If(
     SortDescending1, 
     Descending, 
     Ascending
     )
    )

     Please note all of this is free-typed, so watch commas and brackets etc.

     

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

  • WarrenBelz Profile Picture
    156,434 Most Valuable Professional on at

    Hi @ShadowTech ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

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

  • vladimir84 Profile Picture
    322 on at

    I have the same issue, and I also tried multiple SortByColumns and Sort

    They should work regardless, because they are distinct commands.

    You sort once, and then resort again.

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard