Power BI Advanced Row Level Security Part 2 | Dynamic Row Level Security in PBI| RLS in Power BI

Опубликовано: 20 Апрель 2023
на канале: Life of Business Analyst
716
19

This is another video on Row Level security where the user profile can be easily managed using the back end data model. One user can be assigned multiple roles using this model.
Please check the previous video on Row Level Security if you are a beginner.
Syntax Used:
-- Kindly replace greatersymbol with actualsign

var _Role_Region =
CALCULATETABLE(
VALUES(Dim_Access[Region]),
Dim_Access[EmailID] = USERPRINCIPALNAME())

var _Role_Country =
CALCULATETABLE(
VALUES(Dim_Access[Country]),
Dim_Access[EmailID] = USERPRINCIPALNAME())

var _Role_Client =
CALCULATETABLE(
VALUES(Dim_Access[Client]),
Dim_Access[EmailID] = USERPRINCIPALNAME())

RETURN
if(CALCULATE(COUNT(Dim_Access[Region]) ,Dim_Access[EmailID] = USERPRINCIPALNAME()) greatersymbol 0,
Data[Region] in _Role_Region,

if(CALCULATE(COUNT(Dim_Access[Country]) ,Dim_Access[EmailID] = USERPRINCIPALNAME()) greatersymbol 0,
Data[Country] in _Role_Country,

if(CALCULATE(COUNT(Dim_Access[Client]) ,Dim_Access[EmailID] = USERPRINCIPALNAME()) greatersymbol 0,
Data[Client] in _Role_Client
,Data[Client]= "X" )))