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 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
    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

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard