How to add column from another table in Power BI [3 Different ways]

Do you have a requirement on how to add column from another table in power bi? This Power BI tutorial explains, how to add column from another table in power bi in different ways.

  1. Add column from another table in Power bi Dax
  2. Add column from another table in power query
  3. Adds column from another table Lookup in Power BI

1. Add column from another table in power bi dax

Let us see how to add a column from another table using the Power BI Dax formula with and without the relationship between two tables in Power BI,

In this post, I have used the vehicle sample data, which you can download from here.

Table 1: (Bikes Table)

Add column from another table power bi Dax
Add column from another table power bi Dax

Table 2: (Cars Table)

Add column from another table in power bi Dax
Add column from another table in power bi Dax

Add a column from another table with a relationship between tables in Power BI

Let us see how to add a column from another table with a relationship between two tables in Power BI.

  • To make a relationship between two tables, make sure both tables should contain the same column. So that we can make the relationship between the two tables.

Follow the below steps to make a relationship between the two tables:

  • Open the Power Bi desktop, and load the two tables into it. In the Model section, select the vertical ellipsis icon and click on the Manage relationships as below:
add column from another table in power bi
Add a column from another table when there is a relationship between tables
  • In the Manage relationship window, select the tables and columns related to it and click on the ok button.
add column from another table in power bi dax
Add a column from another table when there is a relationship between two tables
  • The below screenshot represents the cardinality relationship between the two tables.
add column from different table power bi
Add column from another table power bi Dax example
  • Now in the Data section, under the Table tools select the New column option as shown below:
Add column from another table using power bi Dax
Add a column from another table using power bi Dax
  • In the formula bar, apply the below-mentioned formula and click on the check icon,
Column from another table = RELATED(Cars[Car Names])

where,

  1. Column from another table = New column name,
  2. Cars = Another Table name
  3. Car Names = Another Table’s column name

In the below screenshot, you can see that the new column has been added and displays the column data value presented in another table.

Add column from another table using power bi Dax example
Add column from another table using power bi Dax example

This is how to add a column from another table with a relationship between two tables in Power BI.

Read How to create a table in Power bi

Add a column from another table with no relationship between tables in Power BI

Let us see how we can add a column from another table with no relationship between two tables in Power BI,

  • Initially open the Power BI desktop and load the two tables’ data into it. In the Model section make sure that the tables have no cardinality relationship as below:
power bi add column from another table in query editor
Add a column from another table with no relationship between the tables
  • In the Data section, under the Table tools select the New column option, and in the formula bar, apply the below-mentioned formula and click on the check icon:
Column data from another table = 
var Color = Bikes[Color]
var CarModel = CALCULATE(MAX(Cars[Car Model]),Cars[Color]= Color)
return CarModel

where,

  1. Column data from another table = New column name,
  2. Color, CarModel = Variable names
  3. Bikes = Another Table name
  4. Car Model,Color = Column names
  • In the below screenshot, you can see that the new column has been added and displays the column data value presented in another table.
adding two columns from different tables in power bi
Add a column from another table with no relationship between the example of the table

This is how to add a column from another table with no relationship between two tables in Power BI.

This is how to add a column from another table using the Power BI Dax formula with and without the relationship between two tables in Power BI.

Read Power Bi Table Manipulation Functions

2. Add column from another table in Power query

Let us see how to add the index column using the power query editor in Power BI,

In this example, I’ll add the index column from index 1 in the vehicles table data.

  • Open the Power BI desktop, and load the table data into it, In the ribbon, under the Home option click on the Transform data option.
  • It will redirect to the power query editor, select the table for which you want to add an index column, and in the ribbon choose the Add column option.
  • Expand the index column and choose the starting index, either we can select index 0, index 1, or custom index.
Add column from another table in the power query
Add column from another table in the power query
  • Click on the close and Apply option, so that changes will appear on the Power BI desktop.
= Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type)
  • In the below screenshot, you can see the newly created index column in the vehicle table data.
add column from another table in power query
Add column from another table in the power query example

This is how to add the index column using the power query editor in Power BI.

3. Add a column from another table lookup in Power BI

Let us see how to add a column from another table using the LookUp function in Power BI,

  • Initially open the Power BI desktop and load the two tables’ data into it.
  • In the Data section, under the Table tools select the New column option, and in the formula bar, apply the below-mentioned formula and click on the check icon:
Column data from another table= LOOKUPVALUE(Bikes[Bike Names],Bikes[Color],Cars[Color])

where,

  1. Column data from another table = New column name,
  2. Bikes = Another Table name
  3. Bike Names,Color = Column names
  • In the below screenshot, you can see that the new column has been added and displays the column data value presented in another table.
Power Bi adds column from another table Lookup
Power Bi adds a column from another table Lookup

This is how to add a column from another table using the LookUp function in Power BI.

This Power Bi tutorial explained, how to add columns from another table in Power BI in different ways. It will fix the below issues.

  • Add column from another table power bi Dax
  • Add a column from another table with a relationship between tables
  • Add a column from another table with no relationship between the tables
  • Add a column from another table in the power query
  • Power Bi adds a column from another table Lookup
  • add column from another table in power bi
  • add column from another table in power bi dax
  • add column from another table in power query
  • add column from different table power bi
  • add columns from different tables power bi dax
  • adding two columns from different tables in power bi
  • power bi add column from another table in the query editor

You may like the following Power BI tutorials:

>