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 / power apps gallery wit...
Power Apps
Answered

power apps gallery with multiple filters

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello everyone.  I apologize if this is a rudimentary question, but I am learning power apps and I am new to the filter coding.  I have a power app that has a gallery that is linked to a SharePoint site.  I have two filters for the gallery that, separately work great (thanks @RezaDorrani).  My issue is that I need both to work together on the same gallery, but I am not sure how to combine them to do so. 

 

First code filters the gallery based on the tab selected, the signed in user and the status: 

 

If(vartabselected=1,'SP LIST NAME',vartabselected=2,Filter('SP LIST NAME',User().Email in 'Assigned To'.Email),Filter('SP LIST NAME',User().Email in 'Assigned To'.Email,Progress.Value="Pending"))

 

The second filters the gallery based on the specific selections:

 

SortByColumns(Filter('SP LIST NAME',('Due date' >= cldStart.SelectedDate && 'Due date' <= cldEnd.SelectedDate || cldStart.SelectedDate = Blank() && cldEnd.SelectedDate = Blank()) && (Progress.Value = StatusRadio.Selected.Value || StatusRadio.Selected.Value = Blank()) && (Priority.Value = PriorityRadio.Selected.Value || PriorityRadio.Selected.Value = Blank())
),"DueDate",Descending)

 

I realize the delegation issues and that is okay.  Any assistance you can provide would be greatly appreciated.

 

Thanks

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

    @Anonymous 

    With({_items:SortByColumns(Filter('SP LIST NAME',('Due date' >= cldStart.SelectedDate && 'Due date' <= cldEnd.SelectedDate || cldStart.SelectedDate = Blank() && cldEnd.SelectedDate = Blank()) && (Progress.Value = StatusRadio.Selected.Value || StatusRadio.Selected.Value = Blank()) && (Priority.Value = PriorityRadio.Selected.Value || PriorityRadio.Selected.Value = Blank())
    ),"DueDate",Descending)}, 
     If(vartabselected=1,_items,vartabselected=2,Filter('SP LIST NAME',User().Email in 'Assigned To'.Email),Filter(_items,User().Email in 'Assigned To'.Email,Progress.Value="Pending"))
    )
    
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks Drrickryp.  That worked perfectly. Never would have thought of With{_items:.  I was trying every way I thought I knew how it might go together, but it was pretty far outside my depth of knowledge. If you have a second can you give a quick explanation on how the With Items works.  The rest of the code makes sense to me, but I am not sure how that tied it together.  Thanks so much for the help.  

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Anonymous 

    Sure, the way I used the With() was to create a temporary collection that is the alias for your first formula.  I then simply  inserted it into the second formula.   The beauty of the With() function is that the collection only exists while the function is running.  It is very efficient and I use it all the time, to simplify complicated formulas such as the one you created.  Shane Young has a nice video to show other uses for it.  https://www.youtube.com/watch?v=AYD2oWue7fw  

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Awesome.  I appreciate the explanation

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Smilegif.gif

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Drrickryp,

     

    The filter noted in the top portion works great for the main vartabselected=1 which shows all of the tasks.  How can I make the filters work under the remaining gallery tabs.  This is how the gallery is filtered under the current tab structure. 

     

    varTabSelected=1: all tasks 

    varTabSelected=2: tasks assigned to me

    varTabSelected=3: tasks pending my review

    varTabSelected=4: tasks created by me

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

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard