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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
stevenvd
Regular Visitor

SCD Type 2 in Row Level Security

Hi,

 

I need to apply dynamic RLS. I have implemented this before but now the user table is of SCD type 2. 

So I have a table 'Query' that contains the AD users with the company they have access to + start date and end date. A user can have access to a certain company until a certain date and then the user has no access anymore but he can then again get access. The user can only see data in the fact table for dates in which the user was allowed to see data. So in the example below the user can see data in the fact from Jan 1 2000 till March 15 2018, between March 15 2018 and August 18 2018 the user cannot see data from the fact, and from August 18 2018 onwards he can again see always data. 

 

I have tried many things in the DAX filter in RLS but cannot figure it out. The filter should be something like USERNAME = USERPRINCIPALNAME() to filter the companies and then the fact table should have a filter "posting date" > START_DATE and "posting date" <= END_DATE. 

 

In this example there are 2 rows with the same user and the same company. If there was only 1 row it would have been easy but now I am lost.  Any direction or idea you may have, is more than welcome 🙂

 

I have thought about working with foreign keys with SQL but the real scenario is more complex and seems impossible to do with SQL.

 

Diagram.PNGData.PNG

1 REPLY 1
parry2k
Super User
Super User

@stevenvd  I think it is doable but would like to test at my end and send you the solution (pbix) file. if you can put sample data of few users trnsaction data in excel that will be great. Don't have much time to create daataset at my end to put the solution together.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors