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 / Filter gallery by Pers...
Power Apps
Answered

Filter gallery by Person or Group column using a searchbox

(0) ShareShare
ReportReport
Posted on by 16

Hello,

I am creating an app where I have a gallery to display cases created by users so an admin can filter based on dropdowns outside the gallery. Gallery is connected to a SharePoint list. Besides dropdowns I am including a searchbox so the people can search by the cases assigned to them and this is a person or group column (single choice). Up to this point no delegation problem.

My problem is that when I use the following formula (highlighted in red), the searchbox returns not only the user but also the cases that have not been assigned (items where this column is blank). If I dont use this formula the gallery only displays the cases that have been assigned.

How do I fix the formula so It can return only the cases related to the searchbox and exclude the blank but when there is nothing in the searchbox it shows everything?

SortByColumns(Filter(
If(
ddownStatus.Selected.Result="-" And ddownBuilding.Selected.Result="-" And ddownLocation.Selected.Result ="-",SPList,
ddownStatus.Selected.Result="-" And ddownBuilding.Selected.Result<>"-"And ddownLocation.Selected.Result="-",
Filter(SPList,Building=ddownBuilding.Selected.Result)),

Or(StartsWith('Assigned to:'.DisplayName,TextInput1.Text),IsBlank('Assigned to:')),Created>=DateFrom.SelectedDate And Created<=DateTo.SelectedDate),"Created",Descending)

 

Regards,

Serafin

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,440 Most Valuable Professional on at

    HI @Serafin ,

    Not sure I have got all the and/or strictly correct on first attempt, but here is some improved syntax that might work for you

    SortByColumns(
     Filter(
     SPList,
     (
     (
     ddownStatus.Selected.Result="-" && ddownBuilding.Selected.Result="-" && 
     ddownLocation.Selected.Result ="-"
     ) ||
     Building=ddownBuilding.Selected.Result
     ) &&
     (
     (IsBlank(TextInput1.Text) && IsBlank('Assigned to:')) || 
     StartsWith('Assigned to:'.DisplayName,TextInput1.Text)
     ) &&
     Created>=DateFrom.SelectedDate && Created<=DateTo.SelectedDate
     ),
     "Created",
     Descending
    )

     

    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.

  • Serafin Profile Picture
    16 on at

    Thanks for the reply! I pasted only part of code as I thought first part was working correctly. I have 3 dropdowns (Status, Location and Building) and 1 searchbox (Assigned to - Person or group column). If I understand correctly should I improve the code by using "And" and "Or". My current complete code is as follow:

    SortByColumns(Filter(
    If(
    ddownStatus.Selected.Result="-" And ddownBuilding.Selected.Result="-" And ddownLocation.Selected.Result ="-",SPList,
    ddownStatus.Selected.Result="-" And ddownBuilding.Selected.Result<>"-"And ddownLocation.Selected.Result="-",
    Filter(SPList,Building=ddownBuilding.Selected.Result),
    ddownStatus.Selected.Result="-" And ddownBuilding.Selected.Result="-" And ddownLocation.Selected.Result<>"-",
    Filter(SPList,Location=ddownLocation.Selected.Result),
    ddownStatus.Selected.Result="-" And ddownBuilding.Selected.Result<>"-" And ddownLocation.Selected.Result<>"-",
    Filter(SPList,Building=ddownBuilding.Selected.Result And Location=ddownLocation.Selected.Result),
    ddownStatus.Selected.Result<>"-" And ddownBuilding.Selected.Result="-" And ddownLocation.Selected.Result ="-",
    Filter(SPList,'Request Status'.Value=ddownStatus.Selected.Result),
    ddownStatus.Selected.Result<>"-" And ddownBuilding.Selected.Result<>"-" And ddownLocation.Selected.Result ="-",
    Filter(SPList,'Request Status'.Value=ddownStatus.Selected.Result And Building = ddownBuilding.Selected.Result),
    ddownStatus.Selected.Result<>"-" And ddownBuilding.Selected.Result<>"-" And ddownLocation.Selected.Result <>"-",
    Filter(SPList,'Request Status'.Value=ddownStatus.Selected.Result And Building = ddownBuilding.Selected.Result And Location = ddownLocation.Selected.Result)
    ),Or(StartsWith('Assigned to:'.DisplayName,TextInput1.Text),IsBlank('Assigned to:')),Created>=DateFrom.SelectedDate And Created<=DateTo.SelectedDate),"Created",Descending)

  • Verified answer
    WarrenBelz Profile Picture
    156,440 Most Valuable Professional on at

    Hi @Serafin ,

    Free-typed, so watch the commas and brackets, but this structure should work for you

    SortByColumns(
     Filter(
     SPList,
     (ddownStatus.Selected.Result="-" || 'Request Status'.Value=ddownStatus.Selected.Result) &&
     (ddownBuilding.Selected.Result="-" || Building=ddownBuilding.Selected.Result) &&
     (ddownLocation.Selected.Result ="-" || Location=ddownLocation.Selected.Result) &&
     (IsBlank('Assigned to:') || StartsWith('Assigned to:'.DisplayName,TextInput1.Text) &&
     Created>=DateFrom.SelectedDate && Created<=DateTo.SelectedDate
     ),
     "Created",
     Descending
    )

     

    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.

  • Serafin Profile Picture
    16 on at

    Thanks! I updated the last part and it worked.

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard