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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
sellyeha
Frequent Visitor

How to use Hierarchy table in a filter visual

I have a table of employees and their managers with the path function as a new column(top left in picture)

I have a table of data (bottom of picture). 

 

What I want is to have the filter visual to display all employees under the selected name in the hiarachy. Example, when Walter White is selected in the filter, the expected result in the bottom table should be Jesse Pinkman, Saul Goodman, Walter White. 

 

sellyeha_1-1644388893168.png

 

 

I've implimented hierachy RLS in the modelling section using user principal name in a seperate document. Could one use PATHCONTAINS and MaxX and adapt it to a filter visual somehow...?? I can't wrap my head around it. I have the code that works in the modelling section... 

 
PATHCONTAINS(Employees[Path],MaxX(Filter(Employees,[Email]=USERPRINCIPALNAME()),Employees[ID]))

 

1 ACCEPTED SOLUTION

Hi, @sellyeha 

Try this:

Measure 2 = IF(MAX('Table'[Name]) in 
SUMMARIZE(
FILTER(ALL('Table'),CONTAINSSTRING([_Path],SELECTEDVALUE('Name'[Name]))),[Name]),1,0)

Result:

vangzhengmsft_0-1645003378757.png

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

4 REPLIES 4
v-angzheng-msft
Community Support
Community Support

Hi, @sellyeha 


1. Create a calculation table to summarize the names

Name = SUMMARIZE('Table',[Name])

2. Create a measure as follows, and filter the items with measure is 1 in the filter pane.

Measure = 
var _selectedName=SELECTEDVALUE('Name'[Name])
var _ID=CALCULATE(MAX('Table'[ID]),'Table'[Name]=_selectedName)

var _t1=
    SUMMARIZE(FILTER(ALL('Table'),'Table'[ID]=_ID),[ID])
var _t2=
    SUMMARIZE(FILTER(ALL('Table'),'Table'[Manageer ID]=_ID),[ID])
var _T=UNION(_t1,_t2)
var _IsIn=IF(MAXX('Table',[ID]) in _T, 1,0)

return _IsIn

Result:

vangzhengmsft_0-1644809853491.png

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng

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

This is great. It seems that this will go down only 1 level. Can this be adapted for n levels in a tree? Say for instance that if we added "Skinny Pete", who's boss is Jesse Pinkman. 

Hi, @sellyeha 

Try this:

Measure 2 = IF(MAX('Table'[Name]) in 
SUMMARIZE(
FILTER(ALL('Table'),CONTAINSSTRING([_Path],SELECTEDVALUE('Name'[Name]))),[Name]),1,0)

Result:

vangzhengmsft_0-1645003378757.png

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to work with. Please show the expected outcome.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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