Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowData Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more
Hi,
Is there a way with RLS to filter a column based on if a value is contained within a string?
I have two tables setup, HR People and HR Hierarchy, no connected to each other but can be via Person ID.
The HR people table has all employee IDs, Name and Email address and then the Hierarchy has PersonID and Path (path being a string that contains all the person IDs above that person, seperated by a deilimiter)
I have tried this bit of code but so far it has not worked as I hoped..
VAR
GetUserID =
MAXX(
FILTER('Dim HR People',
'Dim HR People'[Email] = USERPRINCIPALNAME() ),
'Dim HR People'[ID Key] )
RETURN
[Path] = CONTAINSSTRING('_Dim Hierarchy'[Path],GetUserID)
Anyone help would be appreiciated.
Solved! Go to Solution.
Hello @Ben1981
try with this DAX code
In your RLS role definition (for table 'Dim HR Hierarchy')
VAR _UserID =
MAXX(
FILTER('Dim HR People', 'Dim HR People'[Email] = USERPRINCIPALNAME()),
'Dim HR People'[ID Key]
)
RETURN
CONTAINSSTRING('Dim HR Hierarchy'[Path], _UserID)
Hi Ben1981,
We kindly request you to provide sample data that clearly demonstrates your issue or query in a structured format (not as an image) to help us understand and resolve the matter. Please ensure that the data is relevant, free from any sensitive information, and directly related to the issue. Additionally, please share the expected outcome based on the given example.
Thank you.
Hi Ben1981,
Please share some sample data that shows your problem or question clearly in a simple and organized way (not as an image). This will help us understand and solve the issue better. Make sure the data is relevant, does not have any sensitive information, and is related to your problem. Also, please tell us what result you expect from this example.
Thank you.
Thankyou, @Ahmedx and @pankajnamekar25 for your response.
Hi Ben1981,
We appreciate your question on the Microsoft Fabric Community Forum.
We kindly request you to provide sample data that clearly demonstrates your issue or query in a structured format (not as an image) to help us understand and resolve the matter. Please ensure that the data is relevant, free from any sensitive information, and directly related to the issue. Additionally, please share the expected outcome based on the given example.
Thank you.
Hello @Ben1981
try with this DAX code
In your RLS role definition (for table 'Dim HR Hierarchy')
VAR _UserID =
MAXX(
FILTER('Dim HR People', 'Dim HR People'[Email] = USERPRINCIPALNAME()),
'Dim HR People'[ID Key]
)
RETURN
CONTAINSSTRING('Dim HR Hierarchy'[Path], _UserID)
Hi, so this seems to work when I view role as me but if I try view as other and put in the login details for another user then it doens't work.
So not sure if it's because of the view as other isn't working right because of the details I've inputted or if the code above does not work?
study this
VAR
GetUserID =
MAXX(
FILTER('Dim HR People',
'Dim HR People'[Email] = USERPRINCIPALNAME() ),
'Dim HR People'[ID Key] )
RETURN
CONTAINS('_Dim Hierarchy,'_Dim Hierarchy'[Path],GetUserID)
https://radacad.com/dynamic-row-level-security-with-organizational-hierarchy-power-bi
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 23 | |
| 21 | |
| 20 | |
| 17 | |
| 13 |
| User | Count |
|---|---|
| 58 | |
| 51 | |
| 37 | |
| 30 | |
| 26 |