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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
PhillipRothwell
Frequent Visitor

Dynamic RLS by group

Guidance would be much appreciated as I've not previously implemented RLS

 

I've created a data visualisation presenting aggregated data at a school level and am automating how users can view this using Row Level Security Based on the "USERNAME()" returned value. AT present the tables are seperated out between staff and student and I would like to filter data visibility based on staff username and associated School membership.

 

So for example the two tables

 

Username()Staff School
User1aaa
User2bbb
User3bbb
User4ccc
User5aaa

 

Student SchoolStudent Data
aaasvdffdsfs
aaasdfsdfdsf
bbbscfewfew
bbbwffefsfd
cccsdffewefe
bbbsefwefesf
cccsefwfwefwef

 

So if Usern is the returned value. How best to apply RLS so as each staff member can view the school records that only apply to them?

 

Thanks in advance

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@PhillipRothwell 
To use USERNAME() you need Username column in the format of power bi email account. 

 

Some guidance might help:

1. Create a relationship between the schools column for the 2 tables

2. Create the RLS rule in PBI Desktop make Username = USERNAME(). 

3. Publish to PBI Service, add each users in the workspace with Viewer role 

4. Assign the users to the RLS role in Dateset => Security.

 

Paul Zheng _ Community Support Team
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

3 REPLIES 3
Anonymous
Not applicable

@PhillipRothwell 
To use USERNAME() you need Username column in the format of power bi email account. 

 

Some guidance might help:

1. Create a relationship between the schools column for the 2 tables

2. Create the RLS rule in PBI Desktop make Username = USERNAME(). 

3. Publish to PBI Service, add each users in the workspace with Viewer role 

4. Assign the users to the RLS role in Dateset => Security.

 

Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Sumanth_23
Memorable Member
Memorable Member

hi @PhillipRothwell  - yuo can follow the Microsoft documentation to implement RLS. You can create roles and assign folks to specific roles based on how users need to view the data 

 

https://docs.microsoft.com/en-us/power-bi/admin/service-admin-rls#:~:text=Row%2Dlevel%20security%20(....

 

Please mark the post as a solution and provide a 👍 if my comment helped with solving your issue. Thanks!

 

 

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

Proud to be a Super User!



hi @PhillipRothwell - Do let me know if the previous post was clear or you need any additional information regarding setup of RLS.

 

Please mark the post as a solution and provide a 👍 if my comment helped with solving your issue. Thanks!

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

Proud to be a Super User!



Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors