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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

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                    [email protected]       MD,PA,OH

144                    [email protected]                 

 

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 [email protected] it is restricting but when i logged in with [email protected] 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
Anonymous
Not applicable

@Anonymous,

Add a role column in your user table as below.

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



Account ID,                 Email ID,                         State            Role

123                              [email protected]    MD,PA,OH

144                              [email protected]                                  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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@Anonymous,

Add a role column in your user table as below.

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



Account ID,                 Email ID,                         State            Role

123                              [email protected]    MD,PA,OH

144                              [email protected]                                  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

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 [email protected] logs in he is able to see only his data but here when he logs in he is seeing [email protected] data also.

 

Thanks,

Paruchuri

 

Anonymous
Not applicable

@Anonymous,

What data do you want the [email protected]  user to see? As your original post, the  [email protected]  user needs to see everything when there is no data in State column.                     

Regards,
Lydia

Helpful resources

Announcements
Fabric Data Days is here Carousel

Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.