cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Dynamic Row Based Security

I have been following THIS article on how to setup row based security using passed through credentials.

 

I have two identical (duplicates) tables: Employee, and EmployeeSecurity that consist of the following columns:

  • ContactID
  • SupervisorID
  • EmployeeNumber
  • FirstName
  • MiddleName
  • LastName
  • ActiveDirectoryUserName

 

I have a relationship setup between EmployeeSecurity.SupervisorID to Employee.ContactID.

 

I currently have a Role setup on the tabulear model that contains these to tables or dimensions with read access.

The Row Filter I am using could probably use some fixing but I'm not sure where:

 

=Employee[SupervisorID]=LOOKUPVALUE(EmployeeSecurity[SupervisorID],EmployeeSecurity[ActiveDirectoryUserName],USERNAME())

 

I am trying to make it so employees can see their supervisors, and/or supervisors can see their employees.  I'm hoping someone sees either what is wrong with my DAX or maybe I'm going about settin up the relationship incorrectly.

 

This is just for functionality practice to prove Dynamic Row Based Security will work for us.

2 REPLIES 2
Highlighted
Microsoft
Microsoft

Re: Dynamic Row Based Security

Hi @Jasel,

 

According to above tutorial, your DAX filter formula should be:

 =Employee[SupervisorID]=LOOKUPVALUE(EmployeeSecurity[SupervisorID],EmployeeSecurity[ActiveDirectoryUserName],USERNAME(), EmployeeSecurity[SupervisorID], Employee[SupervisorID])

Regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper II
Helper II

Re: Dynamic Row Based Security

Thanks for the response @v-yulgu-msft.

 

I'm wondering if the problem might be a few things together.  Possibly the created relationship with filter direction and a poor understanding of the LOOKUPVALUE DAX.

 

With the changes you suggested the user received no data.  I altered the DAX to:

=Employee[ContactID]=LOOKUPVALUE(EmployeeSecurity[ContactID],EmployeeSecurity[ActiveDirectoryUserName],USERNAME(), EmployeeSecurity[SupervisorID], Employee[SupervisorID])

And now the user sees SOME data but not his/her own records.

 

Does anyone have experiance with this, and if so do you have any documentation, examples I can look at?

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Kudoed Authors