cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AlejandroCortes
Frequent Visitor

RLS based on User Table

Hello everyone.

 

I would like to add RLS to a PBI file by using one of the source tables as the user list. I have the following tables: 

AlejandroCortes_0-1669750619664.png

I would like to use the User table to restrict or provide access to the users to some specific countries, meaning that if a user has, let's say, Country Permission = "Germany, United States, Italy", they can ONLY see the information related to those countries.

 

Can someone help me set this up? (Hope the info above is enough. If not, I can provide some more)

 

I appreciate your help.

1 ACCEPTED SOLUTION
AlejandroCortes
Frequent Visitor

It's resolved! The issue was the DAX function: is not USERNAME(); is USERPRINCIPALNAME().

View solution in original post

6 REPLIES 6
Josh_Boj
Frequent Visitor

It would be really nice if there was one location to manage all of this across all reports...

https://ideas.powerbi.com/ideas/idea/?ideaid=e413d9e7-f785-ed11-a76e-281878bd14b2

AlejandroCortes
Frequent Visitor

It's resolved! The issue was the DAX function: is not USERNAME(); is USERPRINCIPALNAME().

v-jianboli-msft
Community Support
Community Support

Hi @AlejandroCortes ,

 

Does RLS work for table User (2)? Please make sure the [Username] column is in format. What are the relationships between your tables? Are they Single or Both? If they are Both, make sure "Apply security filter in both directions" is selected.

vjianbolimsft_0-1669857520013.png

If these could not work, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

 

Refer to:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,

Jianbo Li

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

 

Hello @huojiami,

 

Unfortunately none of the above worked. I used both user tables (in different samples) as the filter table for RLS but neither attempt worked.

 

I couldn't attach a copy of the file, so I'm sending you prints of the tables, contents, and relationships. I appreciate your help.

AlejandroCortes_0-1669905042906.pngAlejandroCortes_1-1669905061804.pngAlejandroCortes_2-1669905076724.pngAlejandroCortes_3-1669905088994.pngAlejandroCortes_4-1669905115228.pngAlejandroCortes_5-1669905128131.pngAlejandroCortes_6-1669905143255.pngAlejandroCortes_7-1669905194304.pngAlejandroCortes_8-1669905213295.pngAlejandroCortes_9-1669905251592.png

 

v-jianboli-msft
Community Support
Community Support

Hi @AlejandroCortes ,

 

Here is my example:

vjianbolimsft_6-1669775184485.png

vjianbolimsft_7-1669775193248.png

PS: For more details please refer to the attachments

 

Please try:

First duplicate the user table and then split column:

vjianbolimsft_0-1669774813793.png

Output:

vjianbolimsft_1-1669774834902.png

Then create relationship:

vjianbolimsft_2-1669775044757.png

Then apply the RLS:

vjianbolimsft_3-1669775091274.png

Final output:

vjianbolimsft_4-1669775117911.png

vjianbolimsft_5-1669775128481.png

Best Regards,

Jianbo Li

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

Hello Jiambo,

 

So, I tried adding some more data to the tables and replacing the usernames for real ones to test the solution, but unfortunately it didn't work... I don't know if I'm doing something wrong, but this is what I see:

AlejandroCortes_0-1669820805708.png

Now, I changed the RLS filter to the "User (2)" table, assuming that was the issue, but still no good result. 

AlejandroCortes_1-1669821003257.png

Any thoughts on this?

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.