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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
ey_boubellouta
Regular Visitor

Modeling slowly changing dimensions

Hello Community,

I ve been working these last days on 3 tables that I want to get insights from (EmployeeAssignment, Person, Department)

the data looks like :

EmloyeeAssignment Table :

AssignmentIdPersonIdDepartmentIdinfovalidFromvalidTo
123info112/01/202115/01/2021
123info215/01/202131/12/4999
235info110/01/202131/12/4999

 

Department Table :

DepartmentIdinfovalidFromvalidTo
1info101/01/202116/01/2021
1info216/01/202131/12/4999
2info112/01/202131/12/4999

 

Person Table :

PersonIdinfovalidFromvalidTo
1info101/01/202116/01/2021
1info216/01/202131/12/4999
2info112/01/202131/12/4999

 

you can see that when the a specific row in the 3 tables changes, we use the SCD2 to keep the history of the records.

I want to be able to model these tables so I can take a snapshot on a date (any specific date) and see the result based on this date. if I create a sort of surrogate key for each table( ex : combine DepartmentId with validfrom), I wown't be able to replace the forreign keys in the table EmployeeAssignment. How can I hundle this situation ?

 

best regards

 

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @ey_boubellouta 

 

In this scenario, you can add an independent Dim Date table to the model, which is disconnected to all these 3 dimension tables. Then put date column from Date table into a slicer visual, use measures to get corresponding values from each dimension table by comparing the selected date in slicer with validFrom/validTo dates in each dimension table. 

 

For example, you can use a measure like below to get info from Person table. 

PersonInfo =
VAR vSelectedDate = SELECTEDVALUE ( 'Date'[Date] )
RETURN
    MAXX (
        FILTER (
            Person,
            Person[validFrom] <= vSelectedDate
                && Person[validTo] > vSelectedDate
        ),
        Person[info]
    )

 

Or you can refer to below videos and articles to get more ideas about how to deal with SCD. 

Slowly Changing Dimensions in Power BI - YouTube

Working with Slowly Changing Dimensions in Power BI - YouTube

https://p3adaptive.com/2019/06/how-can-i-get-a-lookup-table-from-a-slowly-changing-dimension-scd/ 

MSPTDA 35: Power BI & DAX Formula for Data Modeling with a Slowly Changing Dimensions - YouTube

MSPTDA 34: Data Modeling for Slowly Changing Dimensions with Power Query & Power Pivot - YouTube

 

Hope they are helpful.

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

1 REPLY 1
v-jingzhang
Community Support
Community Support

Hi @ey_boubellouta 

 

In this scenario, you can add an independent Dim Date table to the model, which is disconnected to all these 3 dimension tables. Then put date column from Date table into a slicer visual, use measures to get corresponding values from each dimension table by comparing the selected date in slicer with validFrom/validTo dates in each dimension table. 

 

For example, you can use a measure like below to get info from Person table. 

PersonInfo =
VAR vSelectedDate = SELECTEDVALUE ( 'Date'[Date] )
RETURN
    MAXX (
        FILTER (
            Person,
            Person[validFrom] <= vSelectedDate
                && Person[validTo] > vSelectedDate
        ),
        Person[info]
    )

 

Or you can refer to below videos and articles to get more ideas about how to deal with SCD. 

Slowly Changing Dimensions in Power BI - YouTube

Working with Slowly Changing Dimensions in Power BI - YouTube

https://p3adaptive.com/2019/06/how-can-i-get-a-lookup-table-from-a-slowly-changing-dimension-scd/ 

MSPTDA 35: Power BI & DAX Formula for Data Modeling with a Slowly Changing Dimensions - YouTube

MSPTDA 34: Data Modeling for Slowly Changing Dimensions with Power Query & Power Pivot - YouTube

 

Hope they are helpful.

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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