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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
taikvei
Frequent Visitor

Dynamic RLS with conditions

Hello,

I have a dynamic RLS set up now with a users table related to a data table on 'department' and RLS with USERPRINCIPALNAME().

this works fine.

I have now added a column in my users table that should designate what level of filtering is required - this is either 'department' and 'team', so I have two tables:

 

Users

userdepartment
team
level of access
1dep1team1all
2dep1team2all
3dep1team1team
4
dep1
team1
team
4
dep1
team2
team

 

Data

departmentteamnumber
dep1team111
dep1team222
dep1team333

 

Is it possible for me to set up my RLS to where

IF(level of access = team, then filter data table so that 'data'[team]='users'[team], if not filter to department)

So users 1 and 2 should see all of the data, user 3 should see only team1 data, and user 4 should only see team1 and team 2?
Manually setting this up is not feasible, as my actual list of users can change, and is at > 100 users now.

1 ACCEPTED SOLUTION
taikvei
Frequent Visitor

FIgured it out now.

 

In case anyone else is looking for a solution in the future:

I set up a column in my data table, which would return True/False (but set the column data type as text) :
RLSTeam = CALCULATE( COUNTROWS('Users'), FILTER( 'Users', 'Users'[Team] = [Team] && 'Users'[Access Level]="Team") ) > 0

 

And in my RLS, on the data table, the following:

var Filtered = FILTER('Users','Users'[Email] = USERPRINCIPALNAME())
var TeamLevel = CONTAINS(Filtered,'Users'[Access Level],"Team")
return
IF(IF(TeamLevel,1,0)=1, [RLSTeam] = "TRUE",true)

 

View solution in original post

1 REPLY 1
taikvei
Frequent Visitor

FIgured it out now.

 

In case anyone else is looking for a solution in the future:

I set up a column in my data table, which would return True/False (but set the column data type as text) :
RLSTeam = CALCULATE( COUNTROWS('Users'), FILTER( 'Users', 'Users'[Team] = [Team] && 'Users'[Access Level]="Team") ) > 0

 

And in my RLS, on the data table, the following:

var Filtered = FILTER('Users','Users'[Email] = USERPRINCIPALNAME())
var TeamLevel = CONTAINS(Filtered,'Users'[Access Level],"Team")
return
IF(IF(TeamLevel,1,0)=1, [RLSTeam] = "TRUE",true)

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

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.