Forum Discussion
Row Level Security Errors
- 10 days ago
Hi Lucy01 ,
Create a separate DimTeam table containing one unique row per team:
DimTeam = DISTINCT('DataSheet'[Team])Then create a 1-to-many relationship:
DimTeam[Team] (1) -> DataSheet[Team] (*)Keep your Team Access table as the mapping of UserUPN -> Team. Apply RLS using USERPRINCIPALNAME() to identify the user and return their team, then filter DimTeam.
The flow should be:
User -> Team Access -> Team -> DataSheetThis avoids trying to use DataSheet[Team] directly in the RLS expression when it contains multiple rows.
Thanks!!
Lucy01 Well, what the code is doing is getting the user's USERPRINCIPALNAME which is generally the user's email adress. It is then getting a Team from DataSheet although not sure how that is working exactly unless there is only a single row in DataSheet?? Then it is returning a count of rows after filtering the Team Access table by comparing UserUPN to the email address and Team to the Team and checking if it is > 0.
The way it is going about it is kind of strange honestly. Generally what I would do is to get the user email address and team and simply do a logic statement if the email equals the UserUPN and the team equals the team, then true otherwise false. Do you even need to check the team if the email addresses match?
What is the error you were getting trying to form the relationship? Can you maybe describe your data or provide some samples from the tables you are dealing with?
- Lucy011 month ago
Advocate I
Thanks for your response. Can you explain more about the logic statement as that might be a better way of approaching this, thanks