Forum Discussion
Row level security using if-clause
Hi Dale, unfortunately this is not the solution I am looking for, as it would be very hard to administrate afterwards.
I'll give you the example:
There are two possible restrictions, business area and company. If I need to solve it with roles, I would need to create the following roles:
- Full access:
For users who should see everything
- Restricted access: Company
For users who should see all business areas (this would handle the star (*) cases), but are limited companies
- Restricted access: Business area
For users who should see all companies, but are limited business areas
- Restricted access: Company and business area
For users who have restrictions in both company and business area.
The following scenarios will occur with the above solution:
1) A user will request access. The admin of the dashboard does not know which restrictions this user has, so the admin will need to look up the access rights first and then assign the appropriate role.
2) The access rights of the user get changed: The role in Power BI will need to be changed also
3) It might be that even more dimensions are added, where restrictions need to apply on. Then it would get even more complex, as I need to create even more roles (3 restricted dimensions would mean 8 roles).
I am more looking for a solution where I can tell in the role itself, that in case a star (*) value appears, then it should not apply any restriction, else it should apply the restrictions received.
Hello,
I encountered the same scenario. Did you resolve your issue?
How to create a role with DAX. for example if you wanted to have `Restricted access: Company`?
In my case I would like to get the `company` of current user (by matching the id) and filter rows by this company.
- Anonymous7 years agoNot applicable
Hi Anonymous ,
yes, I have solved my issue, but I solved it differently, not with a DAX statement in the role setup.
I have created calculated tables, that crossjoin the users that have a * (access to everything) with the respective dimension. The DAX statement you'll need is CROSSJOIN().
For example: User A has access to all companies. I therefore receive one line from my security table like the following:
User: Mark
Dimension: Companies
Restriction: *
I am then crossjoining this line with the company dimension, so I am getting a new table that delivers me the user Mark and all companies that exist in that dimension.
This table you can then use to place the RLS restriction on.
Hope this helps, good luck!
- ncbshiva6 years agoAdvocate V
Hi,
Can you please share me the DAX code ?
Regards
Shiva