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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
santhidhanuskod
New Member

Data Model with SCD type 4 implementation

Hi,

 

I have implemented SCD Type 4 and loaded data in 2 diff tables, live and history. WE have lots of tables and all of them are implemented with tpe 4. and we will defintely have many-many relationships when we model this in power bi.

As we maintain data datewise, there will be duplicates in the certain columns. For eg I have  a header column which is duplicated bec of type 4 implementation. We can identify the unique records only with the combination of header and recorddate. 

Business requirement is to select the recorddate in the report and they should be able to see the data for tht particular date.

how cn I model in power bi, how to get rid of man-many issue?

 

2 ACCEPTED SOLUTIONS
Sahir_Maharaj
Super User
Super User

Hello @santhidhanuskod,

 

Can you please try this approach:

 

1. Create a Date Dimension Table

DateTable = ADDCOLUMNS (
    CALENDAR (DATE(2000,1,1), TODAY()),
    "Year", YEAR([Date]),
    "Month", FORMAT([Date], "MMM"),
    "Quarter", "Q" & FORMAT([Date], "Q"),
    "Year-Month", FORMAT([Date], "YYYY-MM")
)

 

2. Create a Bridge Table

BridgeTable = DISTINCT(
    UNION(
        SELECTCOLUMNS( LiveTable, "Header", LiveTable[Header], "RecordDate", LiveTable[RecordDate]),
        SELECTCOLUMNS( HistoryTable, "Header", HistoryTable[Header], "RecordDate", HistoryTable[RecordDate])
    )
)

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

View solution in original post

v-zhengdxu-msft
Community Support
Community Support

Hi @santhidhanuskod 

 

Usually, creating a bridgiing table is a general solution for many-to-many relationships.

vzhengdxumsft_0-1738811005992.png

Many-to-many relationship guidance - Power BI | Microsoft Learn

Connecting Fact Tables in Microsoft Fabric: A Brid... - Microsoft Fabric Community

 

Or you can use the Merge queries to merge tables with the same key value in the Power query.

Merge queries overview - Power Query | Microsoft Learn

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-zhengdxu-msft
Community Support
Community Support

Hi @santhidhanuskod 

 

Usually, creating a bridgiing table is a general solution for many-to-many relationships.

vzhengdxumsft_0-1738811005992.png

Many-to-many relationship guidance - Power BI | Microsoft Learn

Connecting Fact Tables in Microsoft Fabric: A Brid... - Microsoft Fabric Community

 

Or you can use the Merge queries to merge tables with the same key value in the Power query.

Merge queries overview - Power Query | Microsoft Learn

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Sahir_Maharaj
Super User
Super User

Hello @santhidhanuskod,

 

Can you please try this approach:

 

1. Create a Date Dimension Table

DateTable = ADDCOLUMNS (
    CALENDAR (DATE(2000,1,1), TODAY()),
    "Year", YEAR([Date]),
    "Month", FORMAT([Date], "MMM"),
    "Quarter", "Q" & FORMAT([Date], "Q"),
    "Year-Month", FORMAT([Date], "YYYY-MM")
)

 

2. Create a Bridge Table

BridgeTable = DISTINCT(
    UNION(
        SELECTCOLUMNS( LiveTable, "Header", LiveTable[Header], "RecordDate", LiveTable[RecordDate]),
        SELECTCOLUMNS( HistoryTable, "Header", HistoryTable[Header], "RecordDate", HistoryTable[RecordDate])
    )
)

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors