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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Syndicate_Admin
Administrator
Administrator

Custom column using VLookup?

Hello all!

I have been struggling with this for a while, I hope someone can help out.
I have a situation where I have a Power Query / dataset 'dataSet', that can be refreshed with monthly new data. Part of this data set is:

 

Ref numberOwner

100

Jane
101Peter
102Frank
103Jane
104Frank
105Frank

 

Then inside a separate worksheet, I have manually entered the following 'static' additional information:

 

NameDepartment
FrankFinance
JaneSales
PeterFinance

 

I would love for a Power Query method to add a custom column in the existing query, that looks at the name and fills the custom column with the corresponding department. It should then look something like this:

 

Ref numberOwnerDepartment

100

JaneSales
101PeterFinance
102FrankFinance
103JaneSales
104FrankFinance
105FrankFinance

 

In normal excel terms I'd use VLookup. Could anyone help me how to do this using M formula language?

 

Many thanks in advance!

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

In Power Query, you can do this with a merge. The documentation is helpful for this:
https://docs.microsoft.com/en-us/power-query/merge-queries-overview

View solution in original post

3 REPLIES 3
AlexisOlson
Super User
Super User

In Power Query, you can do this with a merge. The documentation is helpful for this:
https://docs.microsoft.com/en-us/power-query/merge-queries-overview

wdx223_Daniel
Super User
Super User

say, Table1 is your dataset and Table2 is your static table and the column of Name is unique, try this code

NewStep=Table.AddColumn(Table1,"Department",each Table2{[Name=[Name]]}?[Department]?)

Hi Syndicate,

Thanks, I've tried it but it didn't quite work yet. I filled in what I believe is the table names, which I made as connection only queries:
NewStep = Table.AddColumn(#"Replaced Value","Department",each #"Name vs Dept"{[Unique names=[Unique names]]}?[Department]?)

"'Replaced Value" = the query where the new column should come with the data present of the first table in my original post

"Name vs Dept" = the connection query containing the columns "Unique names" and "Department".

 

Is it right to make this table I have on the different worksheet into a query in order to use it?

Thanks again!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.

Top Kudoed Authors