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

Dynamic RLS with combination of multiple dimensions

Hello everyone,

 

I want to apply dynamic RLS, but on a combination of two dimensions. For example, I have a Sales FactTable that contains sales data. It also has a DimDepartmentId & a DimCountryId. For the dynamic RLS, I want that a certain user only can see the data of the IT department of Belgium, and the data of the R&D department of France (So not both IT & R&D for both France & Belgium).

 

I currently found a solution, by creating a table OrganizationalStructure. This table contains all combinations of Country & Department. I then added a column in the Sales table 'DimOrgStructureId', referencing to a row in the OrganizationalStructure table. Finally, I created a table that maps the Users with the DimOrgStructureIds of which they should have access to. 

jasperp_1-1620212130711.png

 


My question is, is there a better way to do is? Especially since I do not want to add the DimOrgStructureId to the Sales table. Ideally, the sales table only contains the sales information and the information about the DimCountryId & DimDepartmentId.

 

Thanks a lot in advance.

 

5 REPLIES 5
v-yangliu-msft
Community Support
Community Support

Hi  @jasperp  ,

You can use the external tool Dax studio or the Performance analyzer on Power bi Desktop to test your method to check the overall running time, resource consumption time, etc., to make judgments.

 

This is the installation and use of Dax Studio:

https://daxstudio.org/

https://www.sqlbi.com/articles/capturing-power-bi-queries-using-dax-studio/

 

This is the relevant content of the Performance analyzer:

https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-performance-analyzer

 

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

jasperp
Frequent Visitor

I think I have found a solution myself. I created a new table UserAccessDepCountry. This table contains the Usernames and the combination of the Department & Country they are allowed to see.

jasperp_0-1620292264275.png

In the data model, I did not create a relationship between this table and the Department & Country table. So the data model currently looks like below:

jasperp_1-1620292335781.png

 

For the dynamic RLS, I created the following role:

jasperp_2-1620292373510.png

([DimDepartmentId], [DimCountryId]) IN SELECTCOLUMNS(
FILTER('UserAccessDepCountry', ('UserAccessDepCountry'[UserName] = USERPRINCIPALNAME())), "DimDepartmentId", [DimDepartmentId], "DimCountryId", [DimCountryId])

 

 

This works as I wanted, as it filters on the combination Department-Country, without the need of a new column in the Sales table. However, my question is if this is a valid solution. Will I face performance issues because I don't use relationships, but DAX to filter the Sales table?

Hi, I am having similar scenario. Was there any performance issue when you use dax filter on Fact table?

Hi @MariaJoe , the performance was good in our case, so we used this solution. However, it will probably vary from case to case.

Thanks!

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.