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 / Sort Gallery by multip...
Power Apps
Unanswered

Sort Gallery by multiple columns

(0) ShareShare
ReportReport
Posted on by 13

I have a gallery that i filtered by 2 dropdown plus a searchbox, i would like to add 6 Sort icons like below:

tengilrachid_0-1624575127743.png

Here is my Gallery items :

Filter(

If( Filtersttyp.Selected.Result="Alla" And Filterprio.Selected.Result="Alla",Avtal,
Filtersttyp.Selected.Result="Alla" And Filterprio.Selected.Result<>"Alla",
Filter(Avtal,Avtalsprioritet.Value=Filterprio.Selected.Result),
Filtersttyp.Selected.Result<>"Alla" And Filterprio.Selected.Result="Alla",
Filter(Avtal,Avtalstyp.Value=Filtersttyp.Selected.Result),
Filtersttyp.Selected.Result<>"Alla" And Filterprio.Selected.Result<>"Alla",
Filter(Avtal,Avtalsprioritet.Value=Filterprio.Selected.Result And Avtalstyp.Value=Filtersttyp.Selected.Result)),

StartsWith(Title, SearchBox.Text))

 

Hope that you help me to add those 6 Sort icons! Appreciate your help!

Categories:
I have the same question (0)
  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @tengilrachid ,

     

    1\ Set the onvisible property of your screen:

    Set(Thevar2,true)

     

    2\ You could use this formula on the onselect property of each Sort icon:

    Icon1: Set(Thevar,1);Set(Thevar2,!Thevar2)

    Icon2: Set(Thevar,2);Set(Thevar2,!Thevar2)

    ...

     

    3\ You could use a similar formula on the items property of the gallery:

    If(Thevar=1,If(Thevar2,SortByColumns(LIST139,"Title",Ascending),SortByColumns(LIST139,"Title",Descending)),Thevar=2,If(Thevar2,SortByColumns(LIST139,"Test",Ascending),SortByColumns(LIST139,"Test",Descending)),LIST139)

    vxiaochenmsft_0-1624585267918.png

     

    You could use this formula

    vxiaochenmsft_1-1624585325495.png

     

    to replace my LIST139.

     

    Also, please replace my column name with your column name.

     

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

     

  • tengilrachid Profile Picture
    13 on at

    . its not working with choices column (Would you like to add a choice column to LIST139 and provide Gallery items)

    2. How can i add Sorting : If(Thevar=1,If(Thevar2,SortByColumns(Avtal,"...... to my filter

    Filter(

    If( Filtersttyp.Selected.Result="Alla" And Filterprio.Selected.Result="Alla",Avtal,
    Filtersttyp.Sele.............

  • zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    if your database have less than 2000 record you can use SortByColumn. Code will be simple.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 536

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Haque Profile Picture

Haque 305

Last 30 days Overall leaderboard