Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

New Column based on values from a different table

Hi all, 

I have a table with customer ID and postcode they live in (table A) and another table with postcodes and regions (Table B). I would like to create a column in table A with the Region related to the postcode. 

i have tried the merge function but it looks like the final table is not right! Also playing with a lookupvalue function, however I am getting the "a table if multiple values was supplied where a single value was expected" error

Any help would be greatly appreciated

1 ACCEPTED SOLUTION
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

If the postcode column has unique vaule in the table B, the lookupvalue should work fine as following calculate column

 

Region = LOOKUPVALUE('Table B'[regions],'Table B'[postcode],[postcode])

If one postcode has multi region, you can give me the expected result based on my sample data.

 

2.PNG3.PNG

 

BTW, pbix as attached.

 

Best regards,

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

Community Support Team _ Dong Li
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

4 REPLIES 4
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

If the postcode column has unique vaule in the table B, the lookupvalue should work fine as following calculate column

 

Region = LOOKUPVALUE('Table B'[regions],'Table B'[postcode],[postcode])

If one postcode has multi region, you can give me the expected result based on my sample data.

 

2.PNG3.PNG

 

BTW, pbix as attached.

 

Best regards,

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

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

Hi,

You will need to join the two tables using postcode field and use below dax to create a calculated column in Table A to get the region field from Table B.

Region = RELATED( Table B[Region] )

Thanks.

Anonymous
Not applicable

Tried it, but I am getting an error saying that the region field is not recognised as there is no relationship between the two tables, even thoug hI created the relationship already. 

Is there anything iam missing?

Anonymous
Not applicable

Hi,

Can you share your report pbix?

Thanks.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.