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

Dynamic row level security for multiple tables

Hi,

 

I have a data model in PowerBI with the following setup.

1.jpg

 

1) OIS is our main table with many transactional records for all our customers.

 

2) OIS table direct links to OISPermissionGroup with 1-Many relationship

 

3) All the tables inside the PINK section (ie. OISPermissionGroup, PermissionGroup, UserPermissionGroup, User) are the tables that we are using to identify the user permission. In other words, it allows Power BI to filter the records that are associated to different customers. For example, CustomerA login should only see CustomerA’s data. CustomerB login should only see CustomerB’s data…..and so on. By using this concept, CustomerB should not see other customer’s data in their own login.

 

4) Same time, I did the following settings in the Manage Roles screen under the OIS table with a DAX expression to filter specific user records for a 1-Many relationship between OIS and Hence, I can easily view specific records in OIS table from different user’s perspective by changing int(username()) in the expression to a particular userid and choose “View as Roles” by user.

Here is the DAX I am using in the OIS table:

int(username()) in SELECTCOLUMNS(RelatedTable(OrderedItemSummaryPermissionGroup), "User", [UserId])

 

image.png

5) Table DTD/DTP/PTD/PTP are shipment status (“Status”) tables calculated from OIS by using DAX expression based on certain conditions (ie. SUMMARIZE function from OIS table). These 4 tables are arranged in the same format but just the calculation is slightly different. There is a common calculated column in these 4 tables called “CustomerId”, “Mode” and “Transit Time” which will be used later.

 

6) Combine table is a calculated table that consolidates all the calculated records from DTD/DTP/PTD/PTP by using UNION and SELECTCOLUMNS expression.

 

7) In the Combine table, I created a new column called “Average Target Days” to calculate the average days per each of the DTD/DTP/PTD/PTP table per “CustomerId” per “Status” per “Mode” which is calculated correctly using DAX expression.

 

(8) Now, I want each of our customer to view their own “Average Target Days” based on their own user permission. I tried to add the same DAX expression from step (4) into Combine table but it didn’t work. Basically, I want to create a dynamic row level security with multiple tables just like what I have in the diagram. The DAX formula is not working if I put that formula into the Combine

 

Can anyone help on this issue?

Much thanks!!

 

Best regards,

Emily

 

 

 

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can create a new table to store the user's mailbox and ID. please refer to this blog:https://radacad.com/dynamic-row-level-security-with-power-bi-made-simple 

 

Best Regards,
Liang
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

1 REPLY 1
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can create a new table to store the user's mailbox and ID. please refer to this blog:https://radacad.com/dynamic-row-level-security-with-power-bi-made-simple 

 

Best Regards,
Liang
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.