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
ggipson
Frequent Visitor

Role Level Security on Multiple Tables

I want to set up role level filters using 2 different tables. The default filter is to make this an 'and' filter, meaning I only want the cross sections from these two tables. I need the filters to be an 'or' filter, meaning that I need all from both sections.

 

For example, say I have a sales team table and a location table. I want to view all of John Doe's sales and all of US Sales in the same report. Right now, I can only figure out how to see John Doe's sales in the US.

1 ACCEPTED SOLUTION

I believe we were overthing this. I accidentally posted this same question twice, but the solution is on the other one. I simply put a filter on the sales table for the Employee ID and Location Code. 

 

 

https://community.powerbi.com/t5/Desktop/Role-Level-Security-on-Multiple-Table/m-p/194350/highlight/...

View solution in original post

7 REPLIES 7
OpenDataLab
Helper II
Helper II

 

 

  • Try something like this.  Create a table with the users and country combination2017-06-13_22h28_02.png

     

 

  • The set BI directional filters to your dimension tables, user and country

 

  • 2017-06-13_22h21_57.png
  • In your manage role, put your security filter on the bridge table

2017-06-13_22h25_35.png

 

 By filtering the bridge table, you will propogate filter using the bi-directional relationships to your other 2 dimensions.   This should give you the OR clause that you are looking for.  

 

Remember that you need to include for John Doe a list of all the countries that he should have access to.  Not just the US.

 

Let me know how you get on.

 

 

This is a great creative solution, however this does not work for me. My hierearchies currently have a relationship with a common table that has sales. Power BI will not let me create a full circle of relationships between tables due to abiguity in filtering. Please see my sample data below.

RelationshipError.JPG

CountryCityLocation ID
U.S.Ney YorkA
U.S.AtlantaB
U.S.ChicagoC
CanadaTorontoD
CanadaOttawaE

 

Sales ManagerSales PersonEmployee ID
John DoeJane Doe1
John DoeJanet Jackson2
John DoeTito Jackson3
Rick RossNick LaChey4
Rick RossJustin Timberlake5
Rick RossSteve Austin6

 

 

Employee IDLocation IDAmount
1E $          500.00
1A $          300.00
1B $          250.00
2C $          750.00
2C $          650.00
3D $          200.00
4D $          320.00
5C $          890.00
5C $          400.00
6C $          165.00
6E $          500.00
6A $          230.00
6A $          320.00

 

You can still use the bridge table concept, the key it to ensure that you have the combination of all the users and countries that exist in your data set.

 

Remove the BI directional joins and instead use the following code against the user table and country table under manage roles:

 

User:

CONTAINS (
FILTER ( SecurityBridge, [User] = USERNAME () || [Country] = "US" ),
'SecurityBridge'[User], 'User'[User]
)

 

Country

CONTAINS (
    FILTER ( SecurityBridge, [User] = USERNAME () || [Country] = "US" ),
    'SecurityBridge'[Country], Country[Country]
)

 

2017-06-14_16h48_29.png

This will filter the bridge table for a list of user that are either in the country or is that actual user.  You can then filter the user table appropriately and do the samething for the country table.  This should give you the correct combinations.

 

Let me know how you get on.

 

 

 

I did a CROSSJOIN with the Country and User Tables to make my bridge table. Then I copied your formulas into the role filters. This did not work for me. 

 

Do I need to make any relationships with the bridge table? I tried that with no success.

I have created an example using the data you supplied below.  Row Level Security Example

Hi OpenDataLab,

 

I opened your pbix file and viewed as John Doe , and i adjusted the filter from || to && and In security bridge table i removed canada for Joihn Doe. So i expected to see only US sales..but i still can see everythin? how come? Do I need to send some settings or so?

I believe we were overthing this. I accidentally posted this same question twice, but the solution is on the other one. I simply put a filter on the sales table for the Employee ID and Location Code. 

 

 

https://community.powerbi.com/t5/Desktop/Role-Level-Security-on-Multiple-Table/m-p/194350/highlight/...

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.