How To Add Column From Another Table In Power Bi

How to add a column from another table in Power BI

To add a column from another table in Power BI, you can use different methods depending on your specific requirements. Here are two common approaches:

Method 1: Using DAX formulas

DAX (Data Analysis Expressions) is a formula language used in Power BI to create custom calculations and aggregations. To add a column from another table using DAX, you can follow these steps:

  1. Identify the relationship between the two tables: Make sure there is a relationship already defined between the tables from which you want to add the column and the table where you want to add the column.
  2. Create a new column in the target table: In the Power BI Desktop, select the target table where you want to add the column. Right-click on the table, go to “New Column” in the context menu, and provide a name for the new column.
  3. Write the DAX formula: In the formula bar, enter the DAX formula to retrieve the desired value from the related table. For example, if you want to fetch the “ProductName” from the “Products” table, you can use the following formula:

    =RELATED('Products'[ProductName])

  4. Press Enter to apply the formula: Once you have written the DAX formula, press Enter to apply it. The new column will be populated with the values from the related table.

By using DAX formulas, you can add columns from related tables and perform complex calculations based on relationships between the tables.

Method 2: Using Power Query Editor

If you prefer a graphical approach, you can use the Power Query Editor to add a column from another table. Here’s how:

  1. Open the Power Query Editor: In Power BI Desktop, go to the Home tab, and click on “Edit Queries”.
  2. Connect to the source table and the table with the desired column: In the Power Query Editor, connect to both the source table and the table from which you want to add the column.
  3. Merge the tables: Go to the “Home” tab in the Power Query Editor, click on “Merge Queries”, and select the source table and the table with the desired column. Define the join conditions and choose the appropriate merge type (e.g., inner join).
  4. Expand the merged column: After merging the tables, you will see a new column with a nested table. Click on the expand button in the column header, select the desired column, and click OK. The selected column will be added to the table.
  5. Close and apply the changes: Once you have added the column, click on “Close & Apply” to load the modified table into Power BI.

The Power Query Editor allows you to join tables based on specific criteria and perform advanced transformations on your data.

Related Post

Leave a comment