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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
JamieH
Helper I
Helper I

Left Join to table with multiple records but return one row

I need help with joining two tables in PowerQuery and hoping someone smart can assist.

 

I need to join a TableA which has one record per AppID to TableB which has multiple AppID's (the Primary Key), all with different SystemDate and SystemRecord fields. 

The join needs to bring back just one row and there are some rules around which row should be returned.

 

The logic should look to bring back the row where AppID match across the two tables, and

bring back the row from TableB with the most recent SystemDate if that row has a SystemRecord of either "Q" or "F".  If the row with most recent SystemDate has a SystemRecord of "T" then we should bring back the last row with a SystemRecord of "Q".

 

If TableB only has rows for that AppID with a SystemRecord of "T" then that should be returned. 

 

Does anyone have any suggestions?

 

Thanks in advance

 

2 REPLIES 2
serpiva64
Solution Sage
Solution Sage

Hi,

please post sample data

Hi, 

 

Here is some data examples.  The highlighted rows are the rows to bring back on the join, using the above written logic:

 

TableA

AppID
1001
2001
3001
4001

 

TableB

Row NumberAppIDSystemDateSystemRecordColumn4Column5
1100105 February 2023Q  
2100107 February 2023T  
3100106 February 2023Q  
4100108 February 2023T  
5200108 February 2023F  
6200106 February 2023Q  
7200108 February 2023T  
8300105 February 2023T  
9400104 February 2023Q  
10400104 February 2023T  

 

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.