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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Rudyi
Helper I
Helper I

Vlookup with powerquery from another source

Hi all,

I'm quite new to power query and I'm trying to do I query out of my league. 

I have one table with column of names

Table1

 
Name
AABC
BBCD
CCDE

and second table with naming conventions

Table 2

namingvalue
AA1
BB2
CC3

The result should be like

NameValue
AABC1
BBBCD2
CCDE3

So for each entry in table 1 I want to go through all rows in table 2 and get the value field if Table1.Name starts with Table2.Naming and "not mapped" if nothing found . Let's assume that values in Table 2 are unique. 

 

Any help appreciated! Can't even google this task correctly 😞

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

New column in table 1

new column = maxx(filter(table2,left(table1[Name],len(table2[naming]))=table2[naming]),Table2[value])

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

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

While on Table1, go to the Query Editor and split the column by position to extract the first 2 characters in another column.  Then merge this table with Table2 based on the new column created in Table1.  From Table2, bring over the value column to Table1.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-gizhi-msft
Community Support
Community Support

Hi,

 

Please try this measure:

Measure = 
var a = IF(LEFT(MAX('Table 1'[Name]),LEN(MAX('Table 2'[naming]))) in FILTERS('Table 2'[naming]),LEFT(MAX('Table 1'[Name]),LEN(MAX('Table 2'[naming]))),0)
return
CALCULATE(SUM('Table 2'[value]),FILTER('Table 2','Table 2'[naming]=a))

The result shows:

6.PNG

Here is my test pbix file:

pbix 

Hope this helps.

 

Best Regards,

Giotto Zhi

amitchandak
Super User
Super User

New column in table 1

new column = maxx(filter(table2,left(table1[Name],len(table2[naming]))=table2[naming]),Table2[value])

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 ,

@amitchandak is it possible to do the same on the query level somehow? Same function gives me an error in query editor 😞

@v-gizhi-msft thanks, your solution works as well!

 

Hi,

 

If my answer has solved your solution, please mark it as a solution for others to see.

Thanks!

 

Best Regards,

Giotto Zhi

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.