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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
CHRBAR
New Member

Table1 = USERPRINCIPALNAME() OR Table2 = USERPRINCIPALNAME()

Hi

 

I'm new to DAX and Power BI 

 

I have a problem with RLS.

I have a bunch of tables based on Business Central and Excel files. All are linked to the main table "Trades" including the 2 tables : "Seller" and "Purchaser"

I have then set up RLS to the Seller table with : [E_Mail] = USERPRINCIPALNAME() 

All good so far

 

Small example of the "Trades" table

Trade NoAmountSellerPurchaser

1

500JOEJOE
2200

SAM

SAM
3522JOESAM
4632KATESAM
55612JOEJOE
66523KATEKATE
7522KATESAM

 

Problem is now that SAM only has access to the details in no. 2, where he's the Seller

I am looking for a way to give access to all the deals that the employees are involved in. 
So SAM should see lines 2, 3, 4, 7

 

Any ideas?

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@CHRBAR 

You can setup a RLS rule using a measure as follows, my table is Table33.

Fowmy_0-1705831479215.png

Measure: NOTE:  "SAM" to USERPRINCIPALNAME() 

 

VAR __User = "SAM"
VAR __Result = __User IN ({Table33[Seller], Table33[Purchaser]})
RETURN
    __Result

 


My testing:

Fowmy_1-1705831600716.pngFowmy_2-1705831621682.png

 

 



 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

1 REPLY 1
Fowmy
Super User
Super User

@CHRBAR 

You can setup a RLS rule using a measure as follows, my table is Table33.

Fowmy_0-1705831479215.png

Measure: NOTE:  "SAM" to USERPRINCIPALNAME() 

 

VAR __User = "SAM"
VAR __Result = __User IN ({Table33[Seller], Table33[Purchaser]})
RETURN
    __Result

 


My testing:

Fowmy_1-1705831600716.pngFowmy_2-1705831621682.png

 

 



 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.