Forum Discussion
Power Query - Add column from related table
- 4 years ago
Hi MichaelF1 ,
You can achieve it by the following methods:
1. Power Query: Add a custom column as below in Table2= Table.AddColumn(#"Changed Type", "Cust_PostCode", each Table1[Cust_PostCode]{List.PositionOf(Table1[Cust_Ref],[Cust_Ref])})In addition, you can refer the following blog to achieve it, there are two methods(merge method and add a custom column method) include in this blog.
VLOOKUP in Power Query Using List Functions
Merge method
Add a custom column method
2. DAX: Create a calculated column as below to get it
Column = CALCULATE ( MAX ( 'Table1'[Cust_PostCode] ), FILTER ( 'Table1', 'Table1'[Cust_Ref] = 'Table2'[Cust_Ref] ) )Best Regards
- 4 years ago
Hi MichaelF1 ,
You can download my sample pbix file from this link to get more details about creating custom column in Power Query Editor...
Add a custom column in Power BI Desktop
Best Regards
Hi MichaelF1 ,
You can achieve it by the following methods:
1. Power Query: Add a custom column as below in Table2
= Table.AddColumn(#"Changed Type", "Cust_PostCode", each Table1[Cust_PostCode]{List.PositionOf(Table1[Cust_Ref],[Cust_Ref])})
In addition, you can refer the following blog to achieve it, there are two methods(merge method and add a custom column method) include in this blog.
VLOOKUP in Power Query Using List Functions
Merge method
Add a custom column method
2. DAX: Create a calculated column as below to get it
Column =
CALCULATE (
MAX ( 'Table1'[Cust_PostCode] ),
FILTER ( 'Table1', 'Table1'[Cust_Ref] = 'Table2'[Cust_Ref] )
)
Best Regards
- MichaelF14 years agoHelper III
Thank you very much, I didn't know about the add column method, I'll check it out 🙂