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
bgierwi2
Frequent Visitor

Joining 3 Data Sources with a Time Condition - Followup

On a previous post, I recieved a solution of combining two data sources with a time condition.

This was the post: Joining 2 Data Sources with a Time Condition 

This was solved by @amitchandak 

 

I am now looking to see if the same thing can be done by combining 3 data sources with an outer join.

Where the other 2 data sources have a condition that match if they are within 2 days.

The referenced solution with 2 datasources worked perfectly, now just looking to add another data source.

 

The 2nd source (Railcar) and 3rd Source (Switch) both reference the Railcar Number of the 1st source (Batch).  And the dates must be within 14 days of the 1st source.

 

Batch NumberRailcar NumberDate
A110/1/2025
210/2/2025
C310/3/2025
D410/4/2025

 

Railcar NumberDate
110/2/2025
210/3/2025
3310/4/2025
412/4/2025

 

Switch NumberDate
110/3/2025
210/4/2026
310/5/2025
4410/6/2025

 

I'd like to do an outer merge with a calculation to get below.  Where every entry that didn't match with the 1st source in the date range has its own row (Outer Join)

The same thing as your solution above, just adding another datasource.

 

Batch Number - BatchRailcar Number - BatchDate - BatchRailcar Number - RailDate - RailRailcar Number - SwitchDate - Switch
A110/1/2025110/2/2025110/3/2025
210/2/2025210/3/2025  
     210/4/2026
C310/3/2025  310/5/2025
   3310/4/2025  
D410/4/2025    
   412/4/2026  
     4410/6/2025
4 REPLIES 4
bgierwi2
Frequent Visitor

@amitchandak 

 

That looks like what I am looking for.  Let me review.

 

One followup on both this and the previous example:

In this situation, it is possible for my railcar numbers to repeat as we use the same fleet of cars.

So in this example we could have any of numbers 1, 2, 3, or 4 come back later in the data set with later dates.

In the examples you had sent, if you add another row with a repeat Railcar Number, you get an error due to the relationship and if you remove the relationship you get multiple matches that don't meet the time condition

 

I was hoping that the time condition would prevent the multiple matches.

 

Is it possible to allow for repeat cars in any data set, and have them only match when they match on number and the time condition (14 days)?

 

Using the example before:

Batch NumberRailcar NumberDate
A110/1/2025
210/2/2025
C310/3/2025
D410/4/2025
E112/4/2025

 

Same as earlier, except a repeat Car 1

 

Railcar NumberDate
110/2/2025
210/3/2025
3310/4/2025
412/4/2026
212/6/2025

 

Same as earlier, except a repeat Car 2

 

Batch Number - BatchRailcar Number - BatchDate - BatchRailcar Number - RailDate - Rail
A110/1/2025110/2/2025
210/2/2025210/3/2025
C310/3/2025  
   3310/4/2025
D410/4/2025  
   412/4/2026
E112/4/2025  
   212/6/2025

 

The bottom 2 rows with the repeat cars match with nothing because they are outside the data range

 

If allowing for repeat cars can be resolved on both data sets, this should resolve the entire project!

amitchandak
Super User
Super User

@bgierwi2 , Please see if the attached file can help 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak 

 

That is very close to what I am what I am looking for.

It looks like it is going to match all 3 rows only if all 3 match.

Is it possible to have the rows B and C matchup with the first row independently?

 

Railcar 2 matches with Table B but not Table C

Railcar 3 matches with Table C but not Table B

 

Your example is close, but it looks like it only matches if all 3 match.

Is matching B and C independently with A possible?

 

Batch Number - BatchRailcar Number - BatchDate - BatchRailcar Number - RailDate - RailRailcar Number - SwitchDate - Switch
A110/1/2025110/2/2025110/3/2025
210/2/2025210/3/2025  
     210/4/2026
C310/3/2025  310/5/2025
   3310/4/2025  
D410/4/2025    
   412/4/2026  
     4410/6/2025

@bgierwi2 , Now join is 1-2 and 1-3 . File attached after signature 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors