cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
MahmoudDoudah Regular Visitor
Regular Visitor

HOW TO EXCLUDE USER FROM RLS

samiply I need to exclude the Super End user from RLS Rols,

in order to disply all data to him.

IF UPPER(USERNAME()) <> "ALEX@MICROSOFT.COM" THEN
[Emp_ID] = USERNAME()
END IF;

ALSO TRIED:

IF UPPER(USERNAME()) ="ALEX@MICROSOFT.COM",[Emp_ID] = USERNAME(),TRUE)

 

but I am grtting below error

any advice ?

EXCLUDE FROM RLS.PNG

3 REPLIES 3
Icey Member
Member

Re: HOW TO EXCLUDE USER FROM RLS

Hi @MahmoudDoudah ,

You can refer to this article.

My test results are as follows:

1. Two tables:

HOW TO EXCLUDE USER FROM RLS.PNG

'Is Super End User' is a measure crested like so:

Is Super End User =
IF ( MAX ( Sales[SalesPerson] ) = "A", 1, 0 )

2. Manage Roles:

IF (
    MAXX ( FILTER ( 'Email', 'Email'[Email] = USERNAME () ), [Is Super End User] ) = 0,
    Email[Email] = USERNAME (),
    1 = 1
)

HOW TO EXCLUDE USER FROM RLS 2.png

3. Result for SalesPerson A,

HOW TO EXCLUDE USER FROM RLS _ result for A.png

Result for SalesPerson C,

HOW TO EXCLUDE USER FROM RLS _ result for c.png

Best Regards,

Icey Zhang

 

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

 

MahmoudDoudah Regular Visitor
Regular Visitor

Re: HOW TO EXCLUDE USER FROM RLS

Thanks for the great explination, @Icey 

BUT , the USER is not included on data ....

this user : ALEX@MICROSOFT.COM 
Doesn`t have any records in AGTREF_DIM_RLS table

kindly advice

 

Icey Member
Member

Re: HOW TO EXCLUDE USER FROM RLS

Hi @MahmoudDoudah ,

1. You can create another two tables - 'User' and 'Access' or just one table. 

HOW TO EXCLUDE USER FROM RLS - follow .png

2. Create relationships among them.

3. Manage Roles:

IF (
    MAXX (
        FILTER ( 'User', 'User'[Email] = USERNAME () ),
        RELATED ( 'Access'[Access] )
    ) = "Personal Data",
    User[Email] = USERNAME (),
    "ALL Data" = "All Data"
)

4. Publish to Power BI Service and Manage security on the model.

5. The result for User C:

HOW TO EXCLUDE USER FROM RLS - follow C.png

The result for User D:

HOW TO EXCLUDE USER FROM RLS - follow D.png

Best Regards,

Icey

 

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

Helpful resources

Announcements
Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Power BI Helps Homeless and Trouble Youth

Power BI Helps Homeless and Trouble Youth

We spoke with Power BI Super User, Greg Deckler, about his charity work

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 115 members 1,426 guests
Please welcome our newest community members: