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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
azaterol
Helper V
Helper V

RLS Problem

Hello everyone,

 

I have the following problem.

 

Here is the sample to download:

 

https://easyupload.io/bzdxi0

 

I would like to activate the RLS in my report and would like to work according to the classic hyrarchy system. The agent boss can see all the agents' data and the agent himself can only see his data.

For this purpose, I created a table = "Views" with ID_No and name.

 

This "view table" points to agents.

 

Now the agents can see all of the other agents' data on one page of the report. So in principle they only take on the role of agency boss on this page of the report.

 

Should be displayed this:

azaterol_2-1713268697513.png

 

On all other pages (here "Big Sales") , the agents fall back into their classic roles and can only see their data.

 

Should displayed this:

azaterol_0-1713268599234.png

 

 

 

 

How can I display this here?

 

I'm stuck and I need your advice. Thanks.

1 ACCEPTED SOLUTION

HI @azaterol,

I mean you need a user table to mapping 'user id', username and user roles. You can use the dax function(USERNAME, USERPRINCIPALNAME) that I mentioned above to get the current user role and user id.

Using Username() in DAX with Row-Level Security | Microsoft Power BI Blog | Microsoft Power BI
Then you can use this role as condition to write a if statement expression to redirect to different filter expressions.
For example:
Current user is manager, you should filter on user id field or manager field which match with current user.
Current user is employee, you should filter on the 'user' id field.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @azaterol,

I think you may need a user table to mapping username and correspond user roles. Then you can use username/ userprincipalname function to find out the role, then you can use this as condition to ensure which level the RLS filter apply to achieve dynamic filter effect on different hierarchy levels.

USERNAME() v/s USERPRINCIPALNAME() in RLS for Pow... - Microsoft Fabric Community

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hello @v-shex-msft ,

 

Unfortunately that didn't help me. I have uploaded an example, would it be possible to use the example to illustrate what you mean?

HI @azaterol,

I mean you need a user table to mapping 'user id', username and user roles. You can use the dax function(USERNAME, USERPRINCIPALNAME) that I mentioned above to get the current user role and user id.

Using Username() in DAX with Row-Level Security | Microsoft Power BI Blog | Microsoft Power BI
Then you can use this role as condition to write a if statement expression to redirect to different filter expressions.
For example:
Current user is manager, you should filter on user id field or manager field which match with current user.
Current user is employee, you should filter on the 'user' id field.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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