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
Optimusprime_25
Resolver I
Resolver I

Dynamic RLS based on multiple depts in multiple countries for a specific user

Hello Team,

 

I am currently stuck at implementing RLS for multiple depts in multiple countries for a specific user.

 

I have successfully implemented RLS, in filtering multiple countries for a particular user. But I am unable to filter depts in those countries for a particular user.

 

Please find below link for more details.

https://community.powerbi.com/t5/Desktop/Dynamic-RLS-based-on-multiple-conditions-in-multiple-tables...

 

Thanks in advance.

1 ACCEPTED SOLUTION

Hi @v-rongtiep-msft ,

 

Thanks for your support.

 

I have implemnted the dynamic RLS based on multiple countries and multiple depts for a specific user.

 

Below are the relationships which I have implemented between multiple tables.

 

Optimusprime_25_0-1672832364942.png

Below is the DAX which I have implemented in the roles.

Optimusprime_25_2-1672832627124.png

Optimusprime_25_3-1672832691345.png

In above DAX code, we are restricting country as well as unit of a specific user.

Optimusprime_25_4-1672832895154.png

From above example, we can see that emp3 is having access to USA and Canada and units ABC and XYZ.

So he is able to see the respective data

 

Thank you.

View solution in original post

7 REPLIES 7
Optimusprime_25
Resolver I
Resolver I

Hello @v-rongtiep-msft ,

 

Thanks for your prompt response.

 

I am unable to send the sample pbix file here.

 

I will attach the snapshots of tables below.

This is the user details table, here we cans ee that which user has which access. User should see only data for which he has access (Ex: specific country and specific unit)

 

Optimusprime_25_0-1672723218855.png

Optimusprime_25_1-1672723247301.png

Below is the country table

Optimusprime_25_2-1672723365994.png

Below is the unit table

Optimusprime_25_3-1672723397716.png

Below is the main table in which the data should be restricted for a particular user.

 

Optimusprime_25_4-1672723474107.png

Optimusprime_25_5-1672723503969.png

 

This is teh complete dataset, in which each particular user should see only that data which the user has been provided with the access in user details table.

 

Main agenda of this task is to restrict the data according to the country and unit as well for any particular user.

 

Thanks in advance.

Hi @Optimusprime_25 ,

How about creating relationships between the tables?

vpollymsft_0-1672724557602.pngvpollymsft_1-1672724570960.png

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

Hi @v-rongtiep-msft 

 

I have changed the relationships as you mentioned unfortunately it's not working. 

Complete dataset is visible to the users.

 

Please find below snapshots.

 

Optimusprime_25_0-1672731971796.png

Optimusprime_25_1-1672731992910.png

Optimusprime_25_2-1672732107337.png

Could you please look provide the solution

 

Thanks in advance.

v-rongtiep-msft
Community Support
Community Support

Hi @Optimusprime_25 ,

I have created a simple sample, please refer to it to see if it helps you.

vpollymsft_0-1672710574533.png

 

Then create relationships between the tables.

vpollymsft_1-1672710613057.png

vpollymsft_3-1672710717719.png

 

 

vpollymsft_2-1672710685330.png

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Polly

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

Hi @v-rongtiep-msft ,

 

Thanks for your support.

 

I have implemnted the dynamic RLS based on multiple countries and multiple depts for a specific user.

 

Below are the relationships which I have implemented between multiple tables.

 

Optimusprime_25_0-1672832364942.png

Below is the DAX which I have implemented in the roles.

Optimusprime_25_2-1672832627124.png

Optimusprime_25_3-1672832691345.png

In above DAX code, we are restricting country as well as unit of a specific user.

Optimusprime_25_4-1672832895154.png

From above example, we can see that emp3 is having access to USA and Canada and units ABC and XYZ.

So he is able to see the respective data

 

Thank you.

I have same requirement but getting the below issue

AM_BSL_0-1677087182825.png

also tried this but not working 

AM_BSL_1-1677087525362.png

 

Please suggest

 

@AM_BSL 

 

Please verify the datamodel and create the relationships as it is and also please make sure you have the similar kind of columns in the tables which I have used for joining the tables.

 

In your DAX I can see there is no Related function, which is used for joining the tables. Please make sure you follow the same code and same datamodel in order to make it work.

 

Optimusprime_25_0-1677130515385.png

Optimusprime_25_1-1677130535669.png

 

 

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.