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 / Multiple If Statement ...
Power Apps
Unanswered

Multiple If Statement to Filter Gallery

(0) ShareShare
ReportReport
Posted on by 5,325 Super User 2025 Season 2

I am using a Collection (from SPList1). SPList1 includes columns for AssociateFullName and ManagerName.

I am in need of a multiple 'If' filter.

There is a manager who needs 'Admin' (view/edit all items) access, whose name is also in the ManagerName column of Collection1 (SPList1).

I am trying to write an 'If' filter that accounts for the above.

I believe the below says: 

- If the logged in user's name is in the Collection1 ManagerName column AND the name 'Joe Schmoe' IS NOT in ManagerNameFld.Text then show all items associated with the ManagerName where that name matches the contents of ManagerNameFld.Text.

- If logged in user Position equals 'Associate' show only THAT associate's items.

-Else show all items

Existing If Statement:
If(User().FullName = ManagerNameFld.Text && !"Joe Schmoe" in ManagerNameFld.Text,
Filter(Collection1, ManagerName = ManagerNameFld.Text),
If(UserPositionFld.Text="Associate",
Filter(Collection1, AssociateFullName = User().FullName),
SortByColumns(Filter(Collection1,
StartsWith(AssociateLastName,
AssociateLastNameSearchFld.Text)),
"AssociateFullName"))

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

    @Phineas 

    I think I got your conditions and results correct and with just 1 If().

     

    With({cond1:User().FullName = ManagerNameFld.Text && !"Joe Schmoe" in ManagerNameFld.Text,
     result1:Filter(Collection1, ManagerName = ManagerNameFld.Text),
     cond2:UserPositionFld.Text="Associate",
     result2:Filter(Collection1, AssociateFullName = User().FullName),AssociateFullName &&
     StartsWith(AssociateLastName,AssociateLastNameSearchFld.Text), 
     },
     If(cond1, result1,
     cond2, Sort(result2,AssociateFullName, Ascending),
     Sort(Collection1,AssociateFullName,Ascending)
    )
     
     
    
    

     

     

  • Phineas Profile Picture
    5,325 Super User 2025 Season 2 on at

    I can't get it to work.

    The code is error free until I get to the && before the StartsWith.

    Power Apps also doesn't recognize the 'AssociateLastName' reference after the StartsWith in your version, but it does in mine.

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard