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
buadeoye
Regular Visitor

Lookup of inexact text

Hi everyone, 

 

I have a challenge that I will need your help to resolve.

 

I have 2 data tables : Table1 contains 10 columns and one of the columns contains Postal Code (full), the second Table2 contains 2 columns (Postal Codes and CityName). However the Postal code contains only some elements of the full Postal Code in the Table1.

 

For example, Table1 contains PO5 1LH but Table2 contains PO5 or 1LH.

 

 

 

My challenge is to lookup the Post Code in Table 2 and compare with Table1, if there is any match of the first 3 elements or the last 3 elements, the code will return the Name of the City in Table 1.

 

 

 

Please help 🙏

 

 

 

Thank you 

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@buadeoye,

 

Try this calculated column in Table2:

 

City = 
MAXX (
    FILTER ( Table1, CONTAINSSTRING ( Table1[Postal Code], Table2[Postal Code] ) ),
    Table1[City]
)




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

Proud to be a Super User!




View solution in original post

1 REPLY 1
DataInsights
Super User
Super User

@buadeoye,

 

Try this calculated column in Table2:

 

City = 
MAXX (
    FILTER ( Table1, CONTAINSSTRING ( Table1[Postal Code], Table2[Postal Code] ) ),
    Table1[City]
)




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

Proud to be a Super User!




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.