Forum Discussion
Adding a column from one table to another
- 1 year ago
Hi RichOB
If there's a one-to-many relationship from Table2 to Table1 and the latter is on the many side, you can create this calculated column
RELATED ( Table2[Property_Type] )If there isn't, you can use LOOKUPVALUE
LOOKUPVALUE ( Table2[Property_Type], Table2[Bed_ID], Table1[Bed_ID] )LOOKVALUE will return an error if there are more than one results for the same Bed_ID. You can add more search criteria. Here's the syntax
LOOKUPVALUE ( <result_columnName>, <search_columnName>, <search_value> [, <search2_columnName>, <search2_value>]… [, <alternateResult>] ) - 1 year ago
Hi RichOB
You can achieve this by two methods. Power Query or DAX
Power Query:
Just merge those two tables using the Bed_ID column.
DAX:
Create a relationship between two tables and use a RELATED function.
Property Type = RELATED(Table2[Property Type]) - 1 year ago
Hi RichOB ,
Thank you for reaching out to the Microsoft Fabric Community. I tested your scenario and was able to bring the Property Type from Table2 into Table1 using Bed_ID as the key. In Power BI’s Power Query, you can do this by.
- Opening the Power Query Editor.
- Selecting Table1 and choosing Home > Merge Queries as New.
- In the merge dialog, selecting Table1[Bed_ID] and Table2[Bed_ID] as the join columns, and using a Left Outer Join.
- After merging, expanding the new column and choosing only the Property Type field.
- Selecting Close & Apply to update your data model.
FYI:
Thank you for your responses Visharavana , danextian .
I’ve attached the PBIX file, which includes these steps so you can review the process. If this resolves your issue, you can mark it as the Accepted Solution to assist others.
Hi RichOB
You can achieve this by two methods. Power Query or DAX
Power Query:
Just merge those two tables using the Bed_ID column.
DAX:
Create a relationship between two tables and use a RELATED function.
Property Type = RELATED(Table2[Property Type])