Forum Discussion
tomcch
2 years agoFrequent Visitor
Question on Row Level Security / null mean allow to view all data
Dear all I have a main table storing Customer_ID and related data like Sales. And I have a user role table storing which user could access which customer ID like belows Main Table Customer_ID ...
- Anonymous2 years ago
Hi tomcch ,
According to your statement, I think your requirement is that the User whose Customer ID is null could see all value.
I suggest you to try code as below in Manage Roles 'Main Table'[Custom ID].
[Customer_ID] = VAR _LIST = CALCULATETABLE(VALUES('User Table'[Customer ID]),FILTER(ALL('User Table'),'User Table'[User_Email] = USERPRINCIPALNAME())) RETURN IF("null" in _LIST,CALCULATE(MAX('Main Table'[Customer_ID])),CALCULATE(MAX('Main Table'[Customer_ID]),FILTER('Main Table','Main Table'[Customer_ID] in _LIST)))Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
vanessafvg
2 years agoCommunity Champion
how are you currently restricting with RLS? not quite clear what you are saying
if you userb to see all the data, then you need to set up a role that allows that