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 a Gallery based...
Power Apps
Answered

Filter a Gallery based on a user role

(0) ShareShare
ReportReport
Posted on by 216

Hi all, 

 

I have a Sharepoint list, which has the records for tasks:

Task 

Assigned To

Assignment Date

Standard Time

 

The users are within a team, and they have a common leader. The app that I'm going to develop is that the members can view their own tasks. I have done this part. 

 

But what about the leader can see all tasks? 

 

The user is identified by using User(), so I know who is using this app and I know this user is a member or a leader. 

 

Thanks,

Gavin

Categories:
  • timl Profile Picture
    37,407 Super User 2026 Season 2 on at

    Hi Gavin,

    Supposing that you're displaying your records in a Gallery control, you can control this by using an If statement in the Items property of the control. The formula would look something like this.

    If(User().Email = "TeamLeaderEmailAddress@Domain.Com",
    TaskList,
    Filter(TaskList, 'Assigned To'.Email = User().Email)
    )

    If you are using User().Email to identify the user, I would also recommend that you store the email of the current user in a variable with the Set function and to refer to that variable in your formula. This can help mitigate any delegation problems that may arise.

    Hope that's of some help.

  • gavinleung Profile Picture
    216 on at

    Thanks @timl . But instead hard code, can I refer to another list or a table ? If so, how it can be done ? 

  • Verified answer
    timl Profile Picture
    37,407 Super User 2026 Season 2 on at

    Hi @gavinleung 

    Yes, it's possible to refer to another list. Let's suppose you have a list called LeaderList. This list stores the email addresses of the leaders in a column called LeaderEmailAddress. You can adapt the formula to refer to the LeaderList like so.

     

    If(CountIf(LeaderList, LeaderEmailAdress = User().Email) > 0,
     TaskList,
     Filter(TaskList, 'Assigned To'.Email = User().Email)
    )
  • gavinleung Profile Picture
    216 on at

    I got it done ! Thanks @timl 

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

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard