Forum Discussion
nok
1 year agoAdvocate II
RLS not working for only one table
Hi! I created RLS for several tables in my report, all following the same code (except for the last part where I change the respective table reference). This is the code: var _User = USERPRINCIPAL...
- 1 year ago
I managed to solve this issue by doing a workaround because for some reason RLS doesn't seem to work with bidirectional many-to-many relationships. That was the problem. So to "solve" this, I needed to create a bridge table with two columns: one for the distinct ID that would relate to all the other tables, and another for the RLS Code. Then I applied RLS only to this bridge table, and it worked.
HarishKM
1 year agoSuper User
nok Hey,
I will use below method and dax for the RLS.
- Ensure that Table_E is properly connected to _UserManagement in your data model. If the relationship is missing or directional filtering is incorrect, it might prevent the filter from working.
- Check any privacy settings or configurations in Power BI that might be restricting access to Table_E. Verify Data Type Matching: Confirm that the column types in Table_E match those expected by the RLS code and _UserManagement. Sometimes mismatched data types can lead to issues.
- Ensure there are no conflicting RLS roles applied to Table_E that might be negating the effect of your current code. Verify the syntax and logic in the specific RLS code you've applied to Table_E.
- I can se that you have already tried using TRUE(), which bypasses the filter completely, so the issue may lie elsewhere. Re-import or Refresh the Data: Sometimes simply refreshing or re-importing the data can solve strange visibility issues.
I will use below dax for this - case.VAR _User = USERPRINCIPALNAME()
VAR _Access = CALCULATE( MAXX( FILTER( _UserManagement, _UserManagement[Email] = _User ), _UserManagement[Type] ) )
VAR _Permissions = CALCULATETABLE( VALUES(_UserManagement[RLS_AccessCode]), _UserManagement[Email] = _User )
RETURN
IF( _Access = "Admin", TRUE(), Table_E[RLS_AccessCode] IN _Permissions )
Thanks
Harish KM
If these steps help resolve your issue, your acknowledgment would be greatly appreciated.