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
Imperial56
New Member

Append a column from an unrelated table based on non unique values

Hello,

 

I am trying to append a column to a table with values from another unrelated table. I have tried a few of suggestions found in other threads but they don't quite deliver the correct value. The main issue as there is no way I can see to create a relationship due to duplicate values.

 

As an example I would like to append the "Size" column from Table 2 into table 1 based on the UserID and Variety from table 1 matching the UserID and Variety from table 2.

 

Table 1 Fields have duplicate values.

Table 1:

User ID, Variety

1, Gold

1,Gold

1,Gold

1,Silver

2, Gold

2,Gold

2,Silver

2,Silver

3, Gold

1, Silver

2, Silver

2, Silver

Table 2:

 UserID, Variety, Size

1,Gold, 27.95

1,Silver, 22.50

2,Gold, 28.00

2,Silver, 23.00

3,Gold, 29.00

3,Silver, 23.50

 

The end result should look:

User ID, Variety, Size

1, Gold,27.95

1,Gold,27.95

1,Gold,27.95

1,Silver,22.50

2, Gold,28.00

2,Gold,28.00

2,Silver,23.00

2,Silver,23.00

3, Gold,29.00

1, Silver,22.50

2, Silver,23.00

2, Silver,23.00

 

Any ideas or assistance greatly appreciated.

 

Regards

 

Imperial56

3 ACCEPTED SOLUTIONS
Zubair_Muhammad
Community Champion
Community Champion

@Imperial56

 

You can add a calculated column in Table 1 to LOOKUP the size from Table 2 using LOOKUPVALUE function

 

size =
LOOKUPVALUE (
    Table2[Size],
    Table2[UserID], Table1[User ID],
    Table2[Variety], Table1[Variety]
)

View solution in original post

Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @Imperial56

 

This version of a calcualted column won't break if your lookup table returns multiple results.

 

New Column = MINX(
                FIlTER(
                    'Table2',
                    'Table2'[User ID]=EARLIER('Table1'[User ID]) &&
                    'Table2'[Variety] = EARLIER('Table1'[Variety])
                    ),
                'Table2'[Size])

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

I would recommend to create key in both the tables by concatenating userid + variety and set relationship on this new key column, then it is much easier.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

 

Using the Query Editor, simply join the two tables based on User ID and variety.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @Imperial56

 

This version of a calcualted column won't break if your lookup table returns multiple results.

 

New Column = MINX(
                FIlTER(
                    'Table2',
                    'Table2'[User ID]=EARLIER('Table1'[User ID]) &&
                    'Table2'[Variety] = EARLIER('Table1'[Variety])
                    ),
                'Table2'[Size])

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

I would recommend to create key in both the tables by concatenating userid + variety and set relationship on this new key column, then it is much easier.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

You can unwittingly introduce key collisions and other issues when using composite keys.  LookUpValue is pretty inefficient I agree


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Zubair_Muhammad
Community Champion
Community Champion

@Imperial56

 

You can add a calculated column in Table 1 to LOOKUP the size from Table 2 using LOOKUPVALUE function

 

size =
LOOKUPVALUE (
    Table2[Size],
    Table2[UserID], Table1[User ID],
    Table2[Variety], Table1[Variety]
)

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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