Forum Discussion
Create a role which filters based on a user attribute
I have a table with data like -
Name Level Email
Carol Manager [email protected]
Paul Employee [email protected]
John Associate [email protected]
I have a role set up that filters like " [email] = username() " which works great to filter based on the users data.
i want to change it to filter based on the logged in users level. so if it was Carol logged in, the report would filter and only show "Manager" Level data
Can this be done easily?
Hello,
Yes, you can create the row-level security by using the following DAX Calculations on various levels.
To create a calculated column you can use
Access = PATH(Users[ID],Users[Authority ID])Access = PATH(Users[ID],Users[Authority ID])
And to create the role you can use
PATHCONTAINS(Users[Access], Maxx( Filter(Users,[Email] = USERPRINCIPALNAME() ),Users[ID]))If you liked my solution, please give it a thumbs up. And if I answered your question, please mark my post as a solution.
Thank you!
1 Reply
- piyushszope
Helper I
Hello,
Yes, you can create the row-level security by using the following DAX Calculations on various levels.
To create a calculated column you can use
Access = PATH(Users[ID],Users[Authority ID])Access = PATH(Users[ID],Users[Authority ID])
And to create the role you can use
PATHCONTAINS(Users[Access], Maxx( Filter(Users,[Email] = USERPRINCIPALNAME() ),Users[ID]))If you liked my solution, please give it a thumbs up. And if I answered your question, please mark my post as a solution.
Thank you!