web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Multiple gallery filte...
Power Apps
Answered

Multiple gallery filters not working with sorting

(0) ShareShare
ReportReport
Posted on by 66

Greetings all, 

 

I have a power app that is working fine for Open, closing tasks based on a sharepoint list. The first page is a gallery page showing the list contents. I currently have a sort and filter working with a search box. The gallery displays all Open items first and by newest. I would like to add the ability to filter by all open or all closed items using buttons, radio button or checkbox but any time I add them in the gallery does not display correct. I can get buttons to work by themselves, radio to work by itself and even check box to work by itself but i am not sure why it is not working when i stack in in the below sort/filter of the gallery. 

 

 

SortByColumns(

    Filter(

        'Fire System Impairment Log',

        (StartsWith(

            ImpairTitle,

            srchbox.Text))),

            "Status_x0028_A_x0029_",Descending,"ID", Descending)

 

All the below have worked independently but I can't seem to get the functionality when adding to the above. 

 

If(varSelection="ALL",'Fire System Impairment Log',Filter('Fire System Impairment Log','Status(A)'=varSelection))

If(IsBlank(VarFilter),'Fire System Impairment Log',Filter('Fire System Impairment Log','Status(A)'=VarFilter))
Filter('Fire System Impairment Log','Status(A)'=Radio1.Selected.Value)

 

Any and all help is greatly appreciated!

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @pakalolo13 

    Picking the first in your "works" list...

    Please consider changing your Formula to the following:

    SortByColumns(
     Filter('Fire System Impairment Log',
     StartsWith(ImpairTitle, srchbox.Text),
     varSelection="ALL" || 'Status(A)' = varSelection
     ),
     "Status_x0028_A_x0029_", Descending,
     "ID", Descending
    )

     

    Avoid using If statements in your Items/Filters and simply provide the condition you want to use.

     

    I hope this is helpful for you.

  • pakalolo13 Profile Picture
    66 on at

    Thanks Randy, that worked to get filters by buttons working. I guess I am missing something on the varselection ="all". 

     

    Once I select the open or closed button, it never goes back to sorting the list by the column order. What I mean is i am missing the piece that gets it back to displaying all items in the gallery, which I assume will be by the sortbycolumn values in the formula

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @pakalolo13 

    Is the button method what you are using then?

     

    What do you have that sets the varselection to "all"?

     

    If you're not specifically setting it, then you can also employ the following formula:

    SortByColumns(
     Filter('Fire System Impairment Log',
     StartsWith(ImpairTitle, srchbox.Text),
     Coalesce(varSelection, "ALL") ="ALL" || 'Status(A)' = varSelection
     ),
     "Status_x0028_A_x0029_", Descending,
     "ID", Descending
    )

    This would "default" the varSelection to "ALL"

  • pakalolo13 Profile Picture
    66 on at

    I am using the button method, have three buttons (all, open and closed). Currently on the "Home" app page, which is the first screen in the app and houses the gallery this filter is working on, on the OnVisible property i have UpdateContext({varSelection:All}).

    I also tried your other option using coalesce and that works but only until I select a button. I thought adding the all button would reset it back to the sortbycolumn order.

     

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @pakalolo13 

    What is the formula on your All button OnSelect action?

  • pakalolo13 Profile Picture
    66 on at

    UpdateContext({varSelection:"All"})

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @pakalolo13 

    Okay, that is good.  The only thing I notice is your letter case is all caps in the first formula you posted...I used that to model my response.  However, your formulas you are showing now have mixed case.

     

    So, if it is "All" and not "ALL", then change the formula to:

    SortByColumns(
     Filter('Fire System Impairment Log',
     StartsWith(ImpairTitle, srchbox.Text),
     Coalesce(varSelection, "All") ="All" || 'Status(A)' = varSelection
     ),
     "Status_x0028_A_x0029_", Descending,
     "ID", Descending
    )

     

    NOW...you mentioned " I thought adding the all button would reset it back to the sortbycolumn order."  The change of the variable will not change the sort order - so what are you referring to??

  • pakalolo13 Profile Picture
    66 on at

    Randy! Thank you sooooo much. It was the letter case that had it not working. I went back in an just made sure all the "All" matched as initial caps only.

    So now the default view of the gallery, when All applies, is to show the entire list where Open items show first then sorted in descending order by the ID column. If I select Open it only shows Open items, If I select Closed only closed items appear. The search also works in all filtered options. You will be getting coffee from me!

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @pakalolo13 

    Excellent!  Glad that was all it was!  And...well, what can I say...Love Coffee!! â˜•😊

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 211 Super User 2026 Season 1

#3
VASANTH KUMAR BALMADI Profile Picture

VASANTH KUMAR BALMADI 195

Last 30 days Overall leaderboard