Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
josemendoza
New Member

Looking up values in multiple columns on an Organization Hierarchy

I have the table below.

 

EmployeeManagerManager+1Manager+2Manager+3Manager+4Manager+5
141097811
241097811
341097811
41097811 
561097811
61097811 
7811    
811     
97811   
1097811  

 

As you can see in this company there are 11 employees - the employe 11 is the CEO and he is the uppermost manager. Then each column shows how the hierarchy level of each manager in the organization.

 

I will have a specific manager (lets call him/her Manager X) accessing this dashboard. I would want Manager X to only see the Employees from his own hierarchy. 

For example:

If manager 11 accesses, I would like him to see all 10 rows, as he is the uppermost manager.

If manager 10 accesses, I would like him to see rows 1,2,3,5 and 6 only.

To do this, I created a new measure:

 

Check = IF(MAX('FullHierarchy'[Manager+0])=[Selected_Supervisor]||MAX('FullHierarchy'[Manager+1])=[Selected_Supervisor]||MAX('FullHierarchy'[Manager+2])=[Selected_Supervisor]||

MAX('FullHierarchy'[Manager+3])=[Selected_Supervisor]||MAX('FullHierarchy'[Manager+4])=[Selected_Supervisor]||MAX('FullHierarchy'[Manager+5])=[Selected_Supervisor]||MAX('FullHierarchy'[Manager+6])=[Selected_Supervisor],"Yes","No")

 

The intent of this measure is to find the value of the Manager accessing (selected supervisor) on ALL the manager´s columns, and if found in at least one, have a "Yes", so that I can later filter these "Yes" rows IN. 

 

Unfortunately this measure doesnt work. 

Any ideas? Thanks!

 

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @josemendoza ,

 

Here are the steps you can follow:

1. Copy the Table in Power Query to form Table2.

vyangliumsft_0-1670475868032.png

2. Check the columns with yellow labels – Tranform – Unpivot Columns.

vyangliumsft_1-1670475868036.png

Result:

vyangliumsft_2-1670475868037.png

3. Create measure.

Flag =
var _select=SELECTEDVALUE('Table2'[Value])
var _Flag=SELECTCOLUMNS(FILTER(ALL(Table2),'Table2'[Value]=_select),"1",[Employee])
return
IF(
    MAX('Table'[Employee]) in _Flag,1,0)

4. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_3-1670475868037.png

5. Result:

vyangliumsft_4-1670475868038.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @josemendoza ,

 

Here are the steps you can follow:

1. Copy the Table in Power Query to form Table2.

vyangliumsft_0-1670475868032.png

2. Check the columns with yellow labels – Tranform – Unpivot Columns.

vyangliumsft_1-1670475868036.png

Result:

vyangliumsft_2-1670475868037.png

3. Create measure.

Flag =
var _select=SELECTEDVALUE('Table2'[Value])
var _Flag=SELECTCOLUMNS(FILTER(ALL(Table2),'Table2'[Value]=_select),"1",[Employee])
return
IF(
    MAX('Table'[Employee]) in _Flag,1,0)

4. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_3-1670475868037.png

5. Result:

vyangliumsft_4-1670475868038.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors