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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ez1138
Frequent Visitor

Lookup, new table?

Hi, I pull from SQL server and have a handful of tables.  One table, dbo.contacts and dbo.audits, are the primary tables for this question.

 

For my audit table, I have 4 contacts, contact1, contact2, contact3 and contact4 and need to display all four in my table.  The audit table works fine overall.  For my table within Power BI, how do I lookup the contacts based on their contact_ID from the contacts table?

 

dbo.audit example

 

Audit (audit_ID)Contact1Contact2Contact3Contact4
11324
25324

 

dbo.contact example

Contact (contact_ID)Name (full_name)
1John Smith
2Joe Smith
3Tom Smith
4Jane Smith
1 ACCEPTED SOLUTION
v-deddai1-msft
Community Support
Community Support

Hi @ez1138 ,

 

You can unpivot columns for dbo.audit and you can get a new table structure:

 

Capture.PNG

 

And you can use merge queries or lookupvalue to get contacts:

 

For merge queries:

Capture1.PNGCapture2.PNG

 

And for lookupvalue function:

Name = LOOKUPVALUE('dbo contact'[Name (full_name)],'dbo contact'[Contact (contact_ID)],'dbo.audit'[Contact ID])

Capture3.PNG

 

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

 

Best Regards,

Dedmon Dai

View solution in original post

3 REPLIES 3
v-deddai1-msft
Community Support
Community Support

Hi @ez1138 ,

 

You can unpivot columns for dbo.audit and you can get a new table structure:

 

Capture.PNG

 

And you can use merge queries or lookupvalue to get contacts:

 

For merge queries:

Capture1.PNGCapture2.PNG

 

And for lookupvalue function:

Name = LOOKUPVALUE('dbo contact'[Name (full_name)],'dbo contact'[Contact (contact_ID)],'dbo.audit'[Contact ID])

Capture3.PNG

 

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

 

Best Regards,

Dedmon Dai

amitchandak
Super User
Super User

@ez1138 , Can you unpivot the first column and then remove contract from the column and get id

https://radacad.com/pivot-and-unpivot-with-power-bi

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi, apologize as I went through the link and tried it and maybe made a mistake or two.

 

Is there a LOOKUPVALUE command I can use to populate a new column?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.