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
Chris2016
Resolver I
Resolver I

Row Level Security where report users should see their own data against table aggregates

Hi,

I have to create RLS for a table that has users and team leads:

UserLeadResultStatus
AX1Engaged
AX2Engaged
AX0Engaged
AX1Engaged
B 2Not Engaged
B 3Not Engaged
B 0Not Engaged
B 1Not Engaged
C 0Not Engaged
C 2Not Engaged
C 4Not Engaged
C 3Not Engaged
D 0Not Engaged
D 2Not Engaged
D 1Not Engaged
EY0Engaged
EY1Engaged
FZ2Engaged

 

The requirement is that team leads who exist in the table (aka X, Y Z in column Lead) should see only their own Users but also the aggregate results of people with "Not Engaged" in Status. The purpose is to compare the results of their own users against the results of those "not engaged".
This is what the average results look like with no RLS in place:

Chris2016_1-1693382267405.png

This is what it should look like with the expected RLS in place, where the user who logs in the report is Lead X:

Chris2016_3-1693382339022.png

Column "Lead" in my table is the actual USERPRINCIPALNAME() with which the team lead will log in to open the report.

 

Any idea how this can be done?

Many thanks!

 

 

 

 

 

 

1 ACCEPTED SOLUTION
Chris2016
Resolver I
Resolver I

The answer was pretty simple, I just created an OR condition using both fields:

 

[Status] = "Not Engaged" || [Lead] = userprincipalname()

Chris2016_0-1693565888627.png

Chris2016_1-1693566025702.png

 

Thanks!

 

 

View solution in original post

3 REPLIES 3
Chris2016
Resolver I
Resolver I

The answer was pretty simple, I just created an OR condition using both fields:

 

[Status] = "Not Engaged" || [Lead] = userprincipalname()

Chris2016_0-1693565888627.png

Chris2016_1-1693566025702.png

 

Thanks!

 

 

Chris2016
Resolver I
Resolver I

Thanks a lot, Binbin, I have done something similar to your suggestion, I created the RLS on the table as:

[Lead] = userprincipalname() || [Lead] = blank()

 

Chris2016_0-1693559943261.png


But in my table there are users who are "Engaged", who do not have a manager specified, and I don't want them showing up in the report when RLS is applied.

 

UserLeadResultStatus
AX1Engaged
AX2Engaged
AX0Engaged
AX1Engaged
B 2Not Engaged
B 3Not Engaged
B 0Not Engaged
B 1Not Engaged
C 0Not Engaged
C 2Not Engaged
C 4Not Engaged
C 3Not Engaged
D 0Not Engaged
D 2Not Engaged
D 1Not Engaged
EY0Engaged
EY1Engaged
FZ2Engaged
G 3Engaged
H 2Engaged
I 1Engaged

 

When I apply RLS, Lead X will say - Hey, I don't have 4 users who are engaged in the program, I only have 1:

Chris2016_1-1693560302139.png

I need to be able to use the Engaged Status in the RLS to exlude from the view those users who are engaged but do not have a manager. Thanks for any suggestions!

v-binbinyu-msft
Community Support
Community Support

Hi @Chris2016 ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_0-1693537448697.png

Table2:

Table 2 = VALUES('Table'[Lead])

vbinbinyumsft_1-1693537472005.png

Model:

vbinbinyumsft_2-1693537510389.png

2. create RLS role for Table 2

var _a=USERPRINCIPALNAME()
return
[Lead]=_a||[Lead]=""

vbinbinyumsft_3-1693537613537.png

3. add a slicer with Table 2 field, add table visual with Table fields

Animation22.gif

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the 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.