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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
StuartSmith
Power Participant
Power Participant

Add column from a different table

I have 2 tables "similar" to below

 

Table 1

IDCompany CodeCountryCity
150

Blah

Blah
260BlahBlah
350BlahBlah
431BlahBlah

 

Table 2

IDCompany CodeCompany NameCountryCity
150Company 1

Blah

Blah

260Company 2BlahBlah
350Company 1BlahBlah
430Company 3BlahBlah

 

How can I get the "Company Name" column in "Table 2" to display in "Table 1" so it puts the correct "Company Name" alongside the associated"Company Code" and if there is no corrosponding "Company Code" in "Table 2", then leave "Blank".   Similar to below...

Table 1

IDCompany CodeCompany NameCountryCity
150Company 1

Blah

Blah
260Company 2BlahBlah
350Company 1BlahBlah
431 BlahBlah

 

I am unsure the best approach to do this.  Thanks in advance.

1 ACCEPTED SOLUTION
SanketBhagwat
Solution Sage
Solution Sage

Hi @StuartSmith 
Create an active relationship between Table 1 and Table 2 based on a common column like ID or Company Code.

Now go to your Table 1, add a new column and use below DAX;

CompanyName=RELATED(Table2[Company Name])

Thanks,
Sanket.

If this post helps, then mark it as "Accept as Solution" and give it a thumbs up.





View solution in original post

2 REPLIES 2
HenriqueReis
Resolver I
Resolver I

Hi, how are u?

 

First of all you should create a relation between these tables in here:

HenriqueReis_0-1653562833484.png

You just need to drag "Company" from table1 to "Company" from table2.

After, if you move the information from different table in the same chart, the information will match.

 

Regards!

 

SanketBhagwat
Solution Sage
Solution Sage

Hi @StuartSmith 
Create an active relationship between Table 1 and Table 2 based on a common column like ID or Company Code.

Now go to your Table 1, add a new column and use below DAX;

CompanyName=RELATED(Table2[Company Name])

Thanks,
Sanket.

If this post helps, then mark it as "Accept as Solution" and give it a thumbs up.





Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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