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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Apply RLS

Hello everyone,

I got into trouble when I applied RLS in my dashboard. I have 2 tables: Security_A, and Security_B (photo below).

The user's username in Security_A (user_ID_A) or Security_B(user_ID_B). When the user login the server, the dashboard automatically applies the RLS by username, I set the RLS in the PBI Desktop like the photo below. But it doesn't work. What should I do to fix that? Can anyone help me? Thanks

alicerosa_5-1653230698784.png

 

alicerosa_2-1653230616716.png

alicerosa_3-1653230631523.png

 

 

1 ACCEPTED SOLUTION
jcalheir
Solution Supplier
Solution Supplier

Hi,

 

When working with RLS,  it could be a good practice to use the USERPRINCIPALNAME() native function. This function returns the current authenticated user that is viewing the report. Also, you can filter the dimensions directly in your facts table (Sale_Performance) by looking up the user name in your security table (In this way you dont need to create relashionship between your security and sales table).

 

In the manage roles popup you could filter 'Sale_Performance'[business_Sm] field like this:

 

 

[Business_Sm] = LOOKUPVALUE(

    Security_A[Business_Sm],

    Security_A[User_ID_A],

    USERPRINCIPALNAME()  -- User Authenticated email // If you can, you also can format this string to bring the value you want

)

 

 

Hope it helps

View solution in original post

2 REPLIES 2
JoaoMarcelino
Responsive Resident
Responsive Resident

Excellent @jcalheir 🙂

jcalheir
Solution Supplier
Solution Supplier

Hi,

 

When working with RLS,  it could be a good practice to use the USERPRINCIPALNAME() native function. This function returns the current authenticated user that is viewing the report. Also, you can filter the dimensions directly in your facts table (Sale_Performance) by looking up the user name in your security table (In this way you dont need to create relashionship between your security and sales table).

 

In the manage roles popup you could filter 'Sale_Performance'[business_Sm] field like this:

 

 

[Business_Sm] = LOOKUPVALUE(

    Security_A[Business_Sm],

    Security_A[User_ID_A],

    USERPRINCIPALNAME()  -- User Authenticated email // If you can, you also can format this string to bring the value you want

)

 

 

Hope it helps

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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