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

RLS dynamic logic

Hi all,

 

I need RLS dynamic logic  for the below requirement 

PBIraja_0-1644569694525.png

 


if manager=Y  he want to see his own  total branch  data

manager belongs to north branch he want to see all north branch data.

 

thanks,

raja.

1 ACCEPTED SOLUTION

@PBIraja AGAIN, please provide detail on your relationships. RLS works on the ENTIRE data model. 

 

See attached example, which assumes you do indeed have the AD group for managers, which means we can ignore the Manager = Y filter (your AD group does that already): 

 

AllisonKennedy_0-1644578371959.pngAllisonKennedy_1-1644578405504.pngAllisonKennedy_2-1644578430863.png

 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

10 REPLIES 10
PBIraja
Frequent Visitor

@PBIraja are you able to supply sample data or have you solved this? If solved, please mark a solution.


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

PBIraja
Frequent Visitor

@AllisonKennedy 

ok  i got it  your taking one table mapping to branch column.

but here one more issue 

based on 2 column how can we implment 

branch  is one column same like another column region he want to see total his region data

 

@PBIraja  You're going to need to provide some sample tables/data please. How is region related to branch? Is branch a subset of region? If so then you can just use Region instead of Branch in the above example.


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

AllisonKennedy
Super User
Super User

@PBIraja what does your data model look like? Do you have a security group for managers? What should non-managers see?

 

You could add a simple security filter on the user table:

emil = USERNAME()

 

and then do the rest with relationships. This would probably require a separate AD group for managers and non-managers. 

 

Create a relationship from branch to your fact table in branch.

 

Please provide more details on your data model so we can assist further. Thanks!

 

 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

yes i have AD groups for managers.

if i am taking userprincipal() it showing only his own data only but i need his from which branch he want to see the particular branch all branch data.

 

i implemented like this is it working

 

[branch] = [branch] && ([Manager] = "Y" || [Regional Manager] = "N")

@PBIraja  again, it depends on your data model and relationships. If you have it working, please accept your post as a solution so others can benefit. If not working, please provide a screenshot of your relationships view. 

 

Thanks!


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

@AllisonKennedy 

his from which branch he want to see the particular branch total data.

 

i need RLS logic for the above statement.

@PBIraja AGAIN, please provide detail on your relationships. RLS works on the ENTIRE data model. 

 

See attached example, which assumes you do indeed have the AD group for managers, which means we can ignore the Manager = Y filter (your AD group does that already): 

 

AllisonKennedy_0-1644578371959.pngAllisonKennedy_1-1644578405504.pngAllisonKennedy_2-1644578430863.png

 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

@AllisonKennedy 

Suggest how to use two columns for single RLS role

we have branch and region also 

he want see his branch all data same like his region all data.

 

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.