πWhat Is Row-Level Security in Power BI?
Row-level security (RLS) restricts which rows of data a user can see in a Power BI semantic model. One report serves everyone, but the South regional manager sees only South, a store manager sees only their store, and a salesperson sees only their own customers.
RLS is defined in the model with DAX filters on tables, grouped into roles. Users and groups are assigned to roles in the Power BI Service.
πStatic RLS: Step by Step
Static RLS hard codes values in each role.
[Region] = "South"Static RLS is simple but needs a new role for every new region, so it does not scale well.
πDynamic RLS with USERPRINCIPALNAME
Dynamic RLS uses one role and a security table that maps users to what they can see.
UserSecurity table
Steps:
[Email] = USERPRINCIPALNAME ()USERPRINCIPALNAME() returns the signed in user's UPN, usually their work email. Prefer it over USERNAME(), which can return DOMAIN\user in Desktop.
πManager Hierarchy RLS
Managers often need to see their whole team. With an Employee table holding EmployeeID and ManagerID:
Hierarchy Path = PATH ( Employee[EmployeeID], Employee[ManagerID] )Role filter on Employee:
VAR CurrentEmp = LOOKUPVALUE ( Employee[EmployeeID], Employee[Email], USERPRINCIPALNAME () )RETURN PATHCONTAINS ( Employee[Hierarchy Path], CurrentEmp )Each user sees themselves and everyone below them.
πUsers Who Should See Everything
Add an "All" role with no filter (or a filter of TRUE()) for leadership, or handle it in the security table with a flag column checked in the DAX rule.
πWho RLS Applies To
RLS applies to users with Viewer permission on the workspace, and to users who access content through apps or direct sharing. Workspace Admins, Members and Contributors can edit the model and are not restricted by RLS. This is the most common reason "RLS is not working".
πRLS with DirectQuery and Live Connections
πObject-Level Security (OLS)
OLS hides entire tables or columns, for example a Salary column, from certain roles. Configure it with Tabular Editor on the role, then publish. Visuals that use a hidden column show an error for restricted users, so design reports accordingly.
πTesting RLS Properly
πCommon RLS Mistakes
πFrequently Asked Questions
What is the difference between static and dynamic RLS?
Static RLS hard codes a value per role. Dynamic RLS uses one role and a security table with USERPRINCIPALNAME, so it scales to any number of users.Does RLS work in Power BI Desktop?
You define and test it in Desktop with View as. It is enforced for real users in the Power BI Service.Can RLS be applied to dashboards?
Yes. Dashboard tiles and reports built on the secured semantic model respect RLS.Is RLS asked in interviews?
Very often, especially dynamic RLS and "why is RLS not working". See scenario based interview questions.Is RLS part of PL-300?
Yes, under managing and securing Power BI. See the PL-300 guide.πLearn It Live
Prakalpana's Power BI course covers static, dynamic and hierarchy RLS hands-on, taught live online with an optional 1-on-1 track. See the Power BI learning path, then WhatsApp or call +91 9180377502 for a free demo.