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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
WilliamA
Helper I
Helper I

Dynamic RLS with Hierarchy

Hi all,

 

I have this requirement to implement RLS against multiple columns. I have 4 single level hierarchy tables called Country, State, Area, Module. These tables do not relate to each other.

My Security table looks like the below 

UserID                    Country                     State                   Area             Module

User1             Australia                 NSW                 14            1001             
User1AustraliaNSW141002
User1AustraliaNSW141003
User1New ZealandAll121004
User2AustraliaAllAllAll

 

As an example with my current RLS setup, if User 1 logs in then they have access to Australia and New Zealand, All States, Area 14 and modules 1001 -1003. However, I need to apply security on a row by row level.  for example, if User1 logs in they they should see Australia,NSW,14,1001 or Australia,NSW,14,1004, or New Zealand,All,12,1004

 

My current DAX query is below - As you can see it doesn't take into account all columns and treats it column by column. the same DAX is applied to all my hierarchy tables.

 

How can I implement RLS that returns true if a record matches Country, State, Area and Module?

 

Country Hierarchy Table:

var _Restriction =
CALCULATETABLE(
VALUES('Test Security'[Country]),
'Test Security'[UserID] =USERPRINCIPALNAME()
)
Return
SWITCH(
TRUE(),
"All" in _Restriction, TRUE(),
[Country] in _Restriction , TRUE(),
FALSE()
)

2 REPLIES 2
amitchandak
Super User
Super User

@WilliamA , I have done a workaround to handle all here, check if that can help to create your solution

Power BI- Row Level Security(RLS): Handle ALL, UserPrincipalName: https://youtu.be/KVLEnIUo4pc

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

HI @amitchandak,

I don't think the video quite solves it. your video works on the basis of one table and one column. 

in my scenario,  it needs to filter the data on multiple conditions. 

 

ie, it shouldn't apply rls on one column at the time. I need to do something like 

User1 has access to this country from table 1 and this state from table 2 and this area from table 3 in one line not individual. 

If you take the below example it may it clear it.

 

UserID: User 1, Country = Australia, State = NSW

UserID: User 1, Country = New Zealand, State = All

 

Using the current method, User 1 can see all States for Australia and New zealand where in fact user 1 should only see NSW for Australia and all of New Zealand.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors