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 / Using filter gallery f...
Power Apps
Unanswered

Using filter gallery function across filtered tabs

(0) ShareShare
ReportReport
Posted on by

I have built an app that has a gallery that shows the status of tasks assigned which is filtered by a tab selection in the following manner.

 

varTabSelected=1: all tasks 

varTabSelected=2: tasks assigned to me

varTabSelected=3: tasks pending my review

varTabSelected=4: tasks created by me

 

I also have a built-in filter function for the user in "all tasks" to filter down to the tasks they need.  Thanks to @Drrickryp who provided this awesome code when I was trying to combine the user filter and the tab filter.

 

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

 

Is there a way to make the user filter which works with Tab 1 - All Tasks, have the same functionality regardless of which tab is selected?  Currently, the user is only able to filter the gallery when they are on Tab 1 - All Tasks.  it doesn't work when the user is in Tabs 2-4.

 

Thanks 

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    Hi @Anonymous ,

    I cannot see your data or model, but try this

    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
     )
     },
     Switch(
     vartabselected,
     1,
     _items,
     2, 
     Filter(
     _items,
     User().Email in 'Assigned To'.Email
     ),
     3,
     Filter(
     _items,
     User().Email in 'Assigned To'.Email &&
     Progress.Value = "Pending"
     ),
     4,
     Filter(
     _items,
     'Created By'.Email = User().Email
     )
     )
    )

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Community Power Platform Member Profile Picture
    on at

    Thanks Warren.  Everything seems okay until you get to the Switch portion.  

     

    TerrenceF_0-1672954789835.png

     

    Not sure if this helps.  Here is the code for the OnStart of the app:

     

    ClearCollect(colTabs,{ID:1,Name:"All Tasks",Logo:Icon.DocumentWithContent},{ID:2,Name:"My Tasks",Logo:Icon.LogJournal},{ID:3,Name:"Tasks Pending My Review",Logo:Icon.Publish},{ID:4,Name:"Tasks Created By Me",Logo:Icon.Person});Set(vartabselected,1);Set(varUser,User());Set(varSortColumn,"DueDate");Set(varSortDirection,Descending)

  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    Hi @Anonymous ,

    A couple of stray characters in there (now removed) - see if it works now.

  • Community Power Platform Member Profile Picture
    on at

    Thanks @WarrenBelz ,

     

    I tried the code above again (assuming the changes you made were there) but ended with the same result.  

  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    @Anonymous ,

    One more character (I thought you might have spotted that one) removed - NotePad has no red lines  . . .

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Community Power Platform Member Profile Picture
    on at

    @WarrenBelz , thanks so much for the help with this.  I tried again with the result but found the pesky culprit.  The issue ended up being an extra parenthesis and a missing one.  The one I took out is in red and the one that I added is green.  After that it works perfectly.  Thanks so much for the help with this one.  It was a doozy for sure. 

     

     

    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
    )
    },
    Switch(
    vartabselected,
    1,
    _items,
    2,
    Filter(
    _items,
    User().Email in 'Assigned To'.Email
    ),
    3,
    Filter(
    _items,
    User().Email in 'Assigned To'.Email &&
    Progress.Value = "Pending"
    ),
    4,
    Filter(
    _items,
    'Created By'.Email = User().Email
    )
    )
    )

  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    @Anonymous ,

    That is actually not correct as far as the logic goes - it was one reversed bracket which I have now fixed. 

  • Community Power Platform Member Profile Picture
    on at

    @WarrenBelz 

    You are a life saver.  I sincerely appreciate the help with this one.

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard