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 / Display all the data o...
Power Apps
Answered

Display all the data of the teams you belong to in a drop-down.

(0) ShareShare
ReportReport
Posted on by 87

I am using the following data with Sharepoint List as the data source.

2021-10-06 233510.jpg

 

User1 and User3 belong to only one team, so it is simple, but User2 belongs to two teams, so I want the report names of the two teams to appear in the drop-down.

The value in the User column will be the same as the value obtained from the PowerApps "User().Email", so you can use the account you signed in to PowerApps to filter the teams.

2021-10-06 233914.jpg

For example, in the case of User2, I have acquired the teams "X" and "Z" to which User2 belongs, but I do not know how to use them to display the report names of "Z" and "X".

 

Please, can you give me some good ideas and methods?

 

 

Best regards,

Lopez

 

 

Categories:
  • BCLS776 Profile Picture
    8,994 Moderator on at

    It sounds like you want to check which team(s) a user is a member of, and then generate a list of all reports applicable to those teams? If so, here's how I would do it:

    Clear(colTable);
    ForAll(Distinct(Filter(colTeams, User = User().Email),Team) As userTeams,
     ForAll(Filter(colTeams, Team = userTeams.Result) As aReport,
     If(Len(LookUp(colTeams, Team = userTeams.Result && aReport.User = User().Email, Team)) > 0,
     Collect(colTable,
     { 
     User: User().Email,
     Team: userTeams.Result,
     Report: aReport.Report
     }
     )
     )
     )
    )
    
     

    This needs to go in a behavior formula, such as OnVisible or OnSelect, and generates a collection that contains the table applicable to the currently logged-in user.

     

    Hope that helps,

    Bryan

     

  • Lopez_0090 Profile Picture
    87 on at

    @BCLS776  

    I apologize for the delay in replying.
    Thank you so much!
    I was able to display the data for the team I belong to based on your answer.

     

    However, we have an additional requirement and want to switch the view depending on whether the user is a team manager or not.

    Specifically,

    • Display all the data of the team for which you are the team manager.
    • If not, only data created by you will be displayed.

     

    The data is displayed in Gallery, and the Team to be displayed is selected by a drop-down.

    * User2 can only select "X" and "Z" teams, User3 can only select "X" teams

    2021-10-09 112141.jpg 2021-10-09 121753.jpg

     

    Is it possible to switch the data displayed depending on whether the user is a manager or not in this way?

     

    Best regards,

    Lopez

     

     

  • Verified answer
    BCLS776 Profile Picture
    8,994 Moderator on at

    Yes, this is possible and this is another many-to-many relationship between managers and teams, so the code will have a similar structure to the first sample I posted. The one difference: you will need an If() statement to decide which piece of code to run, depending on whether you are looking for a manager view or not. I am going to let you have the first crack at building this code (now that you have a guideline), but we'll be here in case you get really stuck.

     

    First thing though, how do you decide in your app who the managers are? Do you test the current logged-in user against the list of managers? If so, consider an expression like this for your If() statement:

    If(!IsBlank(LookUp(ManagerList, User = User().Email)),
     // Put code applicable to the manager profile here
     ,
     // Put code applicable to the non-manager profile here
    )

     

    Bryan

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

#2
M Bilal Khan Profile Picture

M Bilal Khan 325

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard