Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Yggdrasill
Responsive Resident
Responsive Resident

Complex Row-level security

I'm struggling with finding the correct solution to a problem that I have.

I have a user table with email addresses.

emailcompany iddepartment iddivision idspecial case 
a@b.comA000
b@c.comB4001
c@c.comB000

 

Now I also have a fact table like so

 

fact idcompany iddepartment iddivision idspecial case
234567A9900
234568A9901
234569B4000
234570B000

 

The steps I need to consider are these

 

  1. First, check what company the user belongs to
  2. Check if the user can view special cases (1 or 0)
  3. If user has 0 in division id then this user will see all divisions and all department, if not use the value to filter fact table
  4. if user has 0 in department id then this user will see all departments under respective divisions

How do I Combine this logic into a DAX code for the roles?

 

I tried implementing similar approach to what Reza Rad does at Radacad: https://radacad.com/dynamic-row-level-security-with-profiles-and-users-in-power-bi

 

I also tried to combine the company id with the special case value, e.g. A-0 (company A and no special cases) or B-1 (company B with special cases) and use that as a Row ID to filter the rows in the fact table. However I don't know how to insert the other logic in 3 & 4.

 

but with no real luck.

1 REPLY 1
v-easonf-msft
Community Support
Community Support

Hi, @Yggdrasill 

You can check whether the solution in this thread works for you.

http://angryanalyticsblog.azurewebsites.net/index.php/2016/12/27/dynamic-rls-via-hierarchy-in-power-... 

 

Best Regards,
Community Support Team _ Eason

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.