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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
bboy2025
New Member

RLS Dynamic

Hi guys

I have a table User which filter my fact table

I would like apply a RLS to display data of people who has the same hierarchy than the user who has loged in Power BI Service

For that, I created a role and apply a filter in my table User

 

[Hierarchy_1] == CALCULATE(SELECTEDVALUE('Dim User'[Hierarchy_1]),'Dim User'[UserPrincipalName]= USERPRINCIPALNAME())

&&

[Hierarchy_2] == CALCULATE(SELECTEDVALUE('Dim User'[Hierarchy_2]),'Dim User'[UserPrincipalName]= USERPRINCIPALNAME())

It doesn't work and displays only data of the user who loged in. It works if I write down the value instead of using CALCULATE....


Do you know how can I implement that?


Thank you

1 ACCEPTED SOLUTION
jgeddes
Super User
Super User

If I have a model with a fact table that is filtered by a user dimension table as follows...

jgeddes_5-1758820185500.png

 

I can set RLS on the dim_user table with this statement to filter the fact table with the hierarchy of the current user...

[hierarchy] == MINX(FILTER('dim_user', 'dim_user'[user] = USERPRINCIPALNAME()), 'dim_user'[hierarchy])

Full example data...

jgeddes_1-1758819802716.png

jgeddes_6-1758820214632.png

 

 

Now with RLS on with  [email protected] as the user...

jgeddes_3-1758819967573.png

jgeddes_7-1758820286435.png

 

 

Hope this helps.

 





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

Proud to be a Super User!





View solution in original post

2 REPLIES 2
bboy2025
New Member

@jgeddes please could you tell me the reason why my formula doesn't work ?

jgeddes
Super User
Super User

If I have a model with a fact table that is filtered by a user dimension table as follows...

jgeddes_5-1758820185500.png

 

I can set RLS on the dim_user table with this statement to filter the fact table with the hierarchy of the current user...

[hierarchy] == MINX(FILTER('dim_user', 'dim_user'[user] = USERPRINCIPALNAME()), 'dim_user'[hierarchy])

Full example data...

jgeddes_1-1758819802716.png

jgeddes_6-1758820214632.png

 

 

Now with RLS on with  [email protected] as the user...

jgeddes_3-1758819967573.png

jgeddes_7-1758820286435.png

 

 

Hope this helps.

 





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

Proud to be a Super User!





Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors