cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bvilten
Helper II
Helper II

Help with Path sort of

I have a table from AD

indexuser.__indexManager_Level_06manager.__indexManager_Level_05Manager_Level_04employeeIDuserPrincipalNameMgrPrincipalNameManager_PathPathLength
93Full NameUser NameMgr NameMgr Name Direct (903)Mgr Name Next Level(354)FN1234Full.Name@mail.comDirect.Manager@mail.com354|903|933

 

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.

 

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

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


Owen Auger

Did I answer your question? Mark my post as a solution!

My Blog
Connect on Twitter
Connect on LinkedIn

View solution in original post

2 REPLIES 2
OwenAuger
Super User
Super User

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


Owen Auger

Did I answer your question? Mark my post as a solution!

My Blog
Connect on Twitter
Connect on LinkedIn

View solution in original post

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.

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors