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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
ADosani
Regular Visitor

How to join a dimension using effective from and to dates

Hello Everyone, 

 

How can I join two dimension tables (Claim Current and Claim History) in Power BI using a common key. Then we need join to the fact table such that the Transaction date is between the effective from and to dates from the History Table.

 

eg. current.commonkey = history.commonkey and fact.transactiondate between history.effectiveFrom and history.effectiveTo

 

Is it possible to do this in PowerBI, instead of Source

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Make sure that the history table has a unique identifier for each row. If it doesn't already, use Power Query to add an index column.

Link the current table to the history table in a one-to-many relationship.

Create a calculated column in the fact table to get the appropriate index from the history table

History Index =
SELECTCOLUMNS (
    FILTER (
        'History',
        'History'[Common Key] = 'Fact'[Common Key]
            && 'History'[Effective From] <= 'Fact'[Transaction Date]
            && (
                ISBLANK ( 'History'[Effective To] )
                    || 'History'[Effective To] >= 'Fact'[Transaction Date]
            )
    ),
    "@value", 'History'[Index]
)

Then link History[Index] to Fact[History Index] in a one-to-many relationship.

View solution in original post

4 REPLIES 4
v-karpurapud
Community Support
Community Support

Hi @ADosani 

I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.

Thank you.

v-karpurapud
Community Support
Community Support

Hi @ADosani 

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

Thank you.

v-karpurapud
Community Support
Community Support

Hi @ADosani 

Could you please confirm if your query have been resolved the solution provided by @johnt75 ? If they have, kindly mark the helpful response and accept it as the solution. This will assist other community members in resolving similar issues more efficiently.

Thank you

johnt75
Super User
Super User

Make sure that the history table has a unique identifier for each row. If it doesn't already, use Power Query to add an index column.

Link the current table to the history table in a one-to-many relationship.

Create a calculated column in the fact table to get the appropriate index from the history table

History Index =
SELECTCOLUMNS (
    FILTER (
        'History',
        'History'[Common Key] = 'Fact'[Common Key]
            && 'History'[Effective From] <= 'Fact'[Transaction Date]
            && (
                ISBLANK ( 'History'[Effective To] )
                    || 'History'[Effective To] >= 'Fact'[Transaction Date]
            )
    ),
    "@value", 'History'[Index]
)

Then link History[Index] to Fact[History Index] in a one-to-many relationship.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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