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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
EvelynN
Frequent Visitor

Add column in Table A based on values being looked up in Table B

I'm struggling to do something that I feel should be fairly simple;

I have two tables Table A which is like this:

Ref 1Ref 2
A1
B2

 

and Table B which is like this

 12
AValue1Value2
BValue3Value4

 

I want to add a column to Table A which uses the references to lookup what the value should be, so my end result in the case above would be

 

Ref 1Ref 2Lookup
A1Value1
B2Value4

 

But I can't quite seem to get what I want in a neat way. Any help would be really appriciated as it'sd driving me slightly crazy.

1 ACCEPTED SOLUTION
NikhilChenna
Continued Contributor
Continued Contributor

Hi @EvelynN ,

You can acheive the above by the below solution,

 

1. You have to unpivot the second table. But i duplicated the table and created a table3/

2. Create a concart column in Table 1 with concat of (Ref1,Ref2).

3. Create a concat column in Table 3 with concat of (Ref1, Attribute).

4. Use Lookup function and lookup the data from table 3 to table1 based on the concat column.

 

Attaching the pbix link for your reference.

Lookup issue pbix link 

 

Here is the output 

NikhilChenna_0-1669374280921.png

Regards,

Nikhil Chenna

 

Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!

View solution in original post

2 REPLIES 2
FreemanZ
Super User
Super User

This is not as simple as it seems.

 

Table B is matrix table, you would need to unpivot it first. Then you can link with Table A with the unpivoted table. 

check this,

https://learn.microsoft.com/en-us/power-query/unpivot-column

 

NikhilChenna
Continued Contributor
Continued Contributor

Hi @EvelynN ,

You can acheive the above by the below solution,

 

1. You have to unpivot the second table. But i duplicated the table and created a table3/

2. Create a concart column in Table 1 with concat of (Ref1,Ref2).

3. Create a concat column in Table 3 with concat of (Ref1, Attribute).

4. Use Lookup function and lookup the data from table 3 to table1 based on the concat column.

 

Attaching the pbix link for your reference.

Lookup issue pbix link 

 

Here is the output 

NikhilChenna_0-1669374280921.png

Regards,

Nikhil Chenna

 

Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.