cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper III
Helper III

create column from different tables

I have 2 tables, and I want to add the Region column to Table 2 based on the Customer Name match. If there is a customer name match, I'd like the region to match what is in Table 1. If there is not a match (i.e. Customer 'C'), I want the value to be Unknown. Can someone assist me with this?

 

Table 1

Customer NameRegion
AUSA
BEurope

 

Table 2

Customer NameRegion (desired column)
AUSA
BEurope
CUnknown
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: create column from different tables

hi  @jack421 

You could use LOOKUPVALUE Function to create a calculate column as below:

https://docs.microsoft.com/en-us/dax/lookupvalue-function-dax

Region = var _region= LOOKUPVALUE('Table 1'[Region],'Table 1'[Customer Name],'Table 2'[Customer Name]) return
IF(ISBLANK(_region),"Unknown",_region)

Result:

2.JPG

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Highlighted
Community Champion
Community Champion

Re: create column from different tables

Hi @jack421 ,

 

See the file attached. You just need to handle it on Power Query (clean values, merge with left or right (depends on where you start it, and finally replace null to Unknown like you wish).

 

Download PBIX 

 

 

Ricardo


Did I answer your question? Mark my post as a solution!
Ricardo

Highlighted
Community Support
Community Support

Re: create column from different tables

hi  @jack421 

You could use LOOKUPVALUE Function to create a calculate column as below:

https://docs.microsoft.com/en-us/dax/lookupvalue-function-dax

Region = var _region= LOOKUPVALUE('Table 1'[Region],'Table 1'[Customer Name],'Table 2'[Customer Name]) return
IF(ISBLANK(_region),"Unknown",_region)

Result:

2.JPG

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors