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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Row level security

This is my measure for row level security. I look up the username and match the manager should be able to see the employee IDs corresponding to the manager ID. 

1 = var stock = LOOKUPVALUE(user_security_dynamic[employee_id]; user_security_dynamic[username]; USERNAME()) RETURN IF(
stock = table1[Manager ID]; 1; 0); but i get this error that a single value for column Manager ID cannot be determined. How can I change this? Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

You may refer to Row-level security (RLS) with Power BI.

 

According to your sample data. I create a role in the Manage roles as follows.

[Username] = username()

12.png

 

The test is this.

13.png14.png

 

 

You can check more details from here.

 

 

Best Regards,

Stephen Tao

 

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

5 REPLIES 5
Anonymous
Not applicable

Hi @Anonymous ,

 

You may refer to Row-level security (RLS) with Power BI.

 

According to your sample data. I create a role in the Manage roles as follows.

[Username] = username()

12.png

 

The test is this.

13.png14.png

 

 

You can check more details from here.

 

 

Best Regards,

Stephen Tao

 

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

amitchandak
Super User
Super User

@Anonymous , how is your data structured? Can you share sample data

In between see if these two can help

https://radacad.com/dynamic-row-level-security-with-organizational-hierarchy-power-bi
https://www.blue-granite.com/blog/using-dynamic-row-level-security-with-organizational-hierarchies

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi thanks for the link; I did try to impelemnt the links you sent; but those are not for my case.

My user security dynamic looks like this. An employee ID can have multiple usernames. 

Usernameemployee_id
Domain\A1017
Domainb\A1017
Domain\B1019
Domain\C2020

 

The rows Im trying to filter looks like this. If employee ID from above table matches with Manager_ID; then those rows should be seen.

 

Employeemanager_id
X1017
X1017
Y1017
Z1019
E2020

@Anonymous That error regarding multiple values generally means you need to wrap a column reference in an aggregation function like MAX or MIN. This may help: https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Hierarchical-Row-Level-Security/m-p/889567#M406



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Create a calulated column with name "Flag"

 

 

FLAG=1

 

 

Now write the RLS code on Flag

 

 

Flag=IF(table1[employee_id] IN SELECTCOLUMNS(Filter('user_security_dynamic','user_security_dynamic'[UserName]=UserName()),"Id",[Emplyee_id]),1,0)

 

 

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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