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! Learn more

Reply
CuriousGeorge
Regular Visitor

Get data from second table based on two columns (formula for Custom Column added)

Hi PowerBI members... first post here, I'm a bit desperate. Trying to figure out how to get a value from one table based on two columns in another:

 

Table 1 has the make and model in different columns, table2 has all possible Models as seperate colums with relative values which I want to populate into a new column on table1. I'm hoping to get the green value/column populated in the example below

 

table1

Name| Make   | Model   |  NewCol

Test   | Make1 | Model3 |  789

 

 

table2

Make  |Model1 |Model2 | Model3

Make1| 123     |  456     |  789

Make2| 001     |  002     |  003

 

 

Please if anybody is able to assist 🙏

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Easiest Way to get Table 2 to look like Table1 is click on Table2, click on Edit Query, Select all the Model columns, Right click, Unpivot columns

 

DAX way will become more and more complicated if you've got a lot of models. see example

 

https://ufile.io/qdmot

View solution in original post

2 REPLIES 2
PattemManohar
Community Champion
Community Champion

@CuriousGeorge If you want to do it DAX then please use below to unpivot the lookup table

 

Test96LkpUnPivot = 
UNION(
 SELECTCOLUMNS(Test96Lkp,"Make",Test96Lkp[Make],"Type","Model1","Value",Test96Lkp[Model1])
,SELECTCOLUMNS(Test96Lkp,"Make",Test96Lkp[Make],"Type","Model2","Value",Test96Lkp[Model2])
,SELECTCOLUMNS(Test96Lkp,"Make",Test96Lkp[Make],"Type","Model3","Value",Test96Lkp[Model3])
)

Now the table will be like this..

 

image.png

 

Then, add a new field in your main table with looking up on above table as below

 

LkpVal = LOOKUPVALUE(Test96LkpUnPivot[Value],Test96LkpUnPivot[Make],Test96[Make],Test96LkpUnPivot[Type],Test96[Model])

image.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Anonymous
Not applicable

Easiest Way to get Table 2 to look like Table1 is click on Table2, click on Edit Query, Select all the Model columns, Right click, Unpivot columns

 

DAX way will become more and more complicated if you've got a lot of models. see example

 

https://ufile.io/qdmot

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