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, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Anonymous
Not applicable

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
Anonymous
Not applicable

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

View solution in original post

6 REPLIES 6
Josh_Boj
Advocate I
Advocate I

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

Anonymous
Not applicable

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

v-jianboli-msft
Community Support
Community Support

Hi @Anonymous ,

 

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.

 

Anonymous
Not applicable

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 @Anonymous ,

 

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.

Anonymous
Not applicable

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
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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