Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Manage Roles

Hi Community,

 

I have implemented dynamic row level security and added table filters in manage roles as below. the below is created in  Employee table. 

 

CONTAINS(
Users,
Users[Email ID],
USERNAME(),
Users[state],
[state]
)

 

Users Table:

 

Account ID,       Email ID,                           State

123                    krishan.1@gmail.com       MD,PA,OH

144                    k.2@gmail.com                 

 

Employee Table:

 

Account ID,    Employee phone number, Employee state, Employee City

123                 1234567890                       MD                     Glenbernie

144                  4567777774                      NY                       Jefferson

 

If i use above DAX expression when i logged in as krishan.1@gmail.com it is restricting but when i logged in with k.2@gmail.com the report is showing blank because there is no data in users table. 

 

If there is no records for state in users table then it has to show everything.

 

How can do this.

 

Please help.

 

Thanks,

Paruchuri

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

@Anonymous,

Add a role column in your user table as below.

Role=IF(Users[State]="","Admin",BLANK())



Account ID,                 Email ID,                         State            Role

123                              krishan.1@gmail.com    MD,PA,OH

144                              k.2@gmail.com                                  Admin

 

Then add DAX filter as follows.

CONTAINS (
Users,
Users[Email ID],
USERNAME(),
Users[Role],
"Admin"
)
||
CONTAINS(
Users,
Users[Email ID],
USERNAME(),
Users[state],
[state]
)



Reference:
https://www.tringuyenminh92.com/index.php/2017/08/11/dynamic-rls-row-level-security-with-power-bi/


Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yuezhe-msft
Employee
Employee

@Anonymous,

Add a role column in your user table as below.

Role=IF(Users[State]="","Admin",BLANK())



Account ID,                 Email ID,                         State            Role

123                              krishan.1@gmail.com    MD,PA,OH

144                              k.2@gmail.com                                  Admin

 

Then add DAX filter as follows.

CONTAINS (
Users,
Users[Email ID],
USERNAME(),
Users[Role],
"Admin"
)
||
CONTAINS(
Users,
Users[Email ID],
USERNAME(),
Users[state],
[state]
)



Reference:
https://www.tringuyenminh92.com/index.php/2017/08/11/dynamic-rls-row-level-security-with-power-bi/


Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi Lydia,

 

When i add "Admin"  Role column, The customer is seeing everything like he can see other customers data also. I don't want that. 

 

For example if customer k.2@gmail.com logs in he is able to see only his data but here when he logs in he is seeing krishan.1@gmail.com data also.

 

Thanks,

Paruchuri

 

@Anonymous,

What data do you want the k.2@gmail.com  user to see? As your original post, the  k.2@gmail.com  user needs to see everything when there is no data in State column.                     

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.