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

lookup value in another table which matches value in another

I'm trying to look for the email in Table 2 and add it as a calculated column in Table 1. There isn't a direct relationship between the 2 tables. They're related via a table which resides between them. I can't use the relationship to simply add the email field. 

 

Table 1 - 

idCampaign name  ownername
Campaign 1  firstname.lastname
Campaign 2  firstname.lastname

 

Table 2 - 

idname  email
1firstname.lastname  name@gmail.com
2firstname.lastname  name2@gmail.com

 

 

I am looking to add email from table 2 to table 1. I'm using the following DAX to add a calculated column to Table1 --> 

campaign email = LOOKUPVALUE('Table2'[email], 'Table2'[name], 'Table1'[ownername])

 

This appears to work, however, I'm not getting values for each record in Table 1. 

 

Hope this makes sense - if there is a different DAX function, please let me know. 

Thanks in advance for your help! 

 

Jim

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

Hi @Anonymous ,

 

If it doesn’t match in table 1, what value do you want to show, a blank? Why don’t you use ID?

You can create a column to find the email based on id.

 

campaign email = LOOKUPVALUE('Table 2'[email], 'Table 2'[id], 'Table 1'[id])

 

campaign email 2 = CALCULATE(MAX('Table 2'[email]),FILTER('Table 2','Table 2'[id]='Table 1'[id]))

 

look1.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

View solution in original post

3 REPLIES 3
andii2617
Regular Visitor

I have a similar issue. The lookup function appears to be working (there is no error), but all the results are blank. In my case, I cannot use an ID, because there are too many options and some names appear in one of the tables more than once.

 

What i'd like for PowerBI to do, using this example, is for the email to show up next to the ownername, each time it is appears in table 1. 

 

Any ideas?

 

Thank you!

v-zhenbw-msft
Community Support
Community Support

Hi @Anonymous ,

 

How about the result after you follow the suggestions mentioned in my original post?

Could you please provide more details or expected result about it If it doesn't meet your requirement?

If you've fixed the issue on your own please kindly share your solution. If the above posts help, please kindly mark it as a solution to help others find it more quickly.

 

Best regards,

 

Community Support Team _ zhenbw

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

v-zhenbw-msft
Community Support
Community Support

Hi @Anonymous ,

 

If it doesn’t match in table 1, what value do you want to show, a blank? Why don’t you use ID?

You can create a column to find the email based on id.

 

campaign email = LOOKUPVALUE('Table 2'[email], 'Table 2'[id], 'Table 1'[id])

 

campaign email 2 = CALCULATE(MAX('Table 2'[email]),FILTER('Table 2','Table 2'[id]='Table 1'[id]))

 

look1.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

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.