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
Phoebe_Zhang
Helper I
Helper I

how to manage role with mutiple values dynamic?

hello,

if user A has company A and B access,

  user B has company C and E and X or any others access. 

  User C...

User D...

how to manger tole with mutiple values dynamic?

 

i have master table with company, and user and role. but how to filter company dynamic by login user account? 

please noted i understand how to manage it if user only has one company access . but there are some different company access..

would you please advise?

thank you.

4 REPLIES 4
v-lid-msft
Community Support
Community Support

Hi @Phoebe_Zhang ,

 

We can try create a user table which contain user's UPN, then apply userprincipalname() function in RLS rules of single roles to implete a dynamic RLS roles. Please refer to this document: https://docs.microsoft.com/en-us/power-bi/service-admin-rls#using-the-username-or-userprincipalname-...

 

1. user table with their UPN

3.jpg

 

2. relationship with fact table( you can also use user column or other)

 

4.jpg

 

3. use userprincipalname() function in rules

[User Email] = userprincipalname()

5.jpg

 

4. the result should be following:

6.jpg7.jpg8.jpg

 

 

 

If it doesn't meet your requirement, Could you please show the exact expected result based on the Tables that we have shared?


By the way, PBIX file as attached.


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

thanks CST,

 

i understand this, but some roles are by company level, some roles may be based on country level, and sales man may based on zone level. this is not fixed. will automaticlly updated by different user.

Not one company field is enough .

i donot kow how to automaticlly filter this.

Hi @Phoebe_Zhang ,

 

Does the role of users are dynamically changed in fact table? If the roles of user does not change frequently, we can create multi user table, such as UPN with Country, UPN with Zone, then create multi RLS roles using differenct user tables and assign users to different roles. If it does not meet your scenario, could you please provide some sample mockup data such as we making above?Please upload your files to OneDrive For Business and share the link here.

 

Please do not contain any confidential information or real data.


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
bheepatel
Resolver IV
Resolver IV

Hi @Phoebe_Zhang 

 

 

My suggestion would be to have a Table similar to the one below and make use of Relationships.

 

You can create a role for each user where you only allow the user access to its UserID. For example, you can create a role "UserID1" and you can use the following DAX expression: Table[UserID] = 1 so that the user can access all rows in the Table below where UserID = 1.

 

Since RLS remains active through relationships, you can then create a relationship between the table below and another table through the CompanyID field.

 

UserIDCompanyID
1A
1B
2A
3A
3B
3C

 

This method will also allow you to add and remove CompanyIDs per User quite easily.

 

Hope this helps!

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.

Top Solution Authors
Top Kudoed Authors