Forum Discussion
Row Level Security Errors
Hi Lucy01,
I think the issue is mainly with where the RLS filter is being applied. I wouldn’t try to relate the Team Access Excel table to all of your report tables.
If you have a Team/DimTeam table, keep Team Access disconnected and apply the role to DimTeam instead:
VAR CurrentUser = LOWER ( TRIM ( USERPRINCIPALNAME() ) ) VAR UserTeams = SELECTCOLUMNS ( FILTER ( ALL ( 'Team Access' ), LOWER ( TRIM ( 'Team Access'[UserUPN] ) ) = CurrentUser ), "Team", TRIM ( 'Team Access'[Team] ) ) RETURN TRIM ( 'DimTeam'[Team] ) IN UserTeams
Make sure DimTeam has a normal 1-to-many relationship with your fact table.
The problem with the original code is this part:
VAR CurrentTeam = TRIM ( 'DataSheet'[Team] )
You're trying to get a single team from the data table while the RLS is being evaluated, which can result in an invalid/multiple-value context.
The idea is simply: get the logged-in user's email → find the teams assigned to that user in Team Access → filter DimTeam to those teams.
If you don't currently have a separate Team dimension, I'd create one first. It will make the RLS much easier to manage.