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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
johnmenx
Frequent Visitor

Dynamically changing hierarchy in a table according to the told that logs in.

I have a table with the hierarchy A B C D E. And sales for each of these. Now A is the top level management, B is next level under A, etc.

So when an A logs in, he needs to see B, C, D, E with thier sales numbers in the table. And because RLS is applied he will only see the data for basically everyone in his team under him. 

If one of the Bs logs in, they see the table as C, D, E and if one of the Cs logs in they will see the table as D, E

For example:
if a regional manager logs in. He needs to see the table as the data for all the area managers under him and then he can drill down the hierarchy to go further.  If an area manager logs in instead, he needs to see the default view starting with the district managers.

Using RLS you can only filter the data that one sees, but you cannot set the default view with which the pages and the tables render. Is there any workaround for this?

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

Hi  @johnmenx ,

I created some data:

Table1:

vyangliumsft_0-1705029666588.png

Table2:

vyangliumsft_1-1705029666589.png

Here are the steps you can follow:

1. Modeling – Manage roles – Create – Table filter Dax expression.

PATHCONTAINS('Table1'[Manager ID],
MAXX(
   FILTER(
        'Table1',[Email]=USERPRINCIPALNAME()),'Table1'[ID]))

vyangliumsft_2-1705029679906.png

2. View as roles.

vyangliumsft_3-1705029679907.png

3. Result:

vyangliumsft_4-1705029705238.png

Refer to :

Dynamic Row Level Security with Organizational Hierarchy Power BI - RADACAD

This is the related document, you can view this content:

Positions in Many-to-Many Relationship - Part 1 - RADACAD

Dynamic Row Level Security with Manager Level Access in Power BI - RADACAD

 

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

1 REPLY 1
v-yangliu-msft
Community Support
Community Support

Hi  @johnmenx ,

I created some data:

Table1:

vyangliumsft_0-1705029666588.png

Table2:

vyangliumsft_1-1705029666589.png

Here are the steps you can follow:

1. Modeling – Manage roles – Create – Table filter Dax expression.

PATHCONTAINS('Table1'[Manager ID],
MAXX(
   FILTER(
        'Table1',[Email]=USERPRINCIPALNAME()),'Table1'[ID]))

vyangliumsft_2-1705029679906.png

2. View as roles.

vyangliumsft_3-1705029679907.png

3. Result:

vyangliumsft_4-1705029705238.png

Refer to :

Dynamic Row Level Security with Organizational Hierarchy Power BI - RADACAD

This is the related document, you can view this content:

Positions in Many-to-Many Relationship - Part 1 - RADACAD

Dynamic Row Level Security with Manager Level Access in Power BI - RADACAD

 

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.