Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
I have a table from AD
index | user.__index | Manager_Level_06 | manager.__index | Manager_Level_05 | Manager_Level_04 | employeeID | userPrincipalName | MgrPrincipalName | Manager_Path | PathLength |
93 | Full Name | User Name | Mgr Name | Mgr Name Direct (903) | Mgr Name Next Level(354) | FN1234 | Full.Name@mail.com | Direct.Manager@mail.com | 354|903|93 | 3 |
I am trying to build a dropdown filter that reflects the logged in user and all their reports not just direct report. Using these two measures I have made it work for a given manager and direct reports.
ReportViewer = USERPRINCIPALNAME()
// This measure below checks to see if the logged in user is a manager
// if not all datea are restricted to the logged in user id by adding MgrUserFilter directly // to a measure where MgrUserFilter is 1
MgrUserFilter =
IF(
SELECTEDVALUE(TechMgrEmail[MgrPrincipalName]) = [ReportViewer] || SELECTEDVALUE(TechMgrEmail[userPrincipalName]) = [ReportViewer] ,1,0
)
I want to have logged in user 903 see user 93 and logged in user 354 should see 903 and 93. The path comes with the table. there are 15,000 plus rows so recreating a path would be painful.
I would truly appreciate your assistance.
Solved! Go to Solution.
Hi @bvilten
To check whether a particular user should be visible (i.e. whether they are either the logged in user or somewhere below the logged in user in the hierarchy), you can check whether the Index of the current user is in the Manager_Path of each user.
You could write your MgrUserFilter as this:
MgrUserFilter =
VAR CurrentUserIndex =
LOOKUPVALUE (
TechMgrEmail[index],
TechMgrEmail[userPrincipalName], [ReportViewer]
)
RETURN
-- Return 0/1
INT (
PATHCONTAINS ( SELECTEDVALUE ( TechMgrEmail[Manager_Path] ), CurrentUserIndex )
)
Regards,
Owen
Hi @bvilten
To check whether a particular user should be visible (i.e. whether they are either the logged in user or somewhere below the logged in user in the hierarchy), you can check whether the Index of the current user is in the Manager_Path of each user.
You could write your MgrUserFilter as this:
MgrUserFilter =
VAR CurrentUserIndex =
LOOKUPVALUE (
TechMgrEmail[index],
TechMgrEmail[userPrincipalName], [ReportViewer]
)
RETURN
-- Return 0/1
INT (
PATHCONTAINS ( SELECTEDVALUE ( TechMgrEmail[Manager_Path] ), CurrentUserIndex )
)
Regards,
Owen
Thank you Owen,
You provided the exact solution I needed. I had finally stumbled across the VLOOKUP function but wasn't sure how to apply it.
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
114 | |
95 | |
86 | |
78 | |
66 |
User | Count |
---|---|
150 | |
118 | |
111 | |
106 | |
95 |