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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
nimblecat
Frequent Visitor

Power Query M: IF with VLOOKUP

I need a Power Query M formula version for creating a "column D" that does a VLOOKUP from TableB on colA but if it doesn't exist, then just pull col C from the original TableA.

 

TableA and TableB has a many:one relationship set-up.

In excel formula this would be:

 

 

col D = IF(VLOOKUP(... ), COLUMN_IN_TABLE_A, VLOOKUP(... )

 

 

TableA: 

col Acol Bcol C
A1apple
A23banana
B3cherry
C4daisy

 

TableB:

col Acol B
Add
Bcc

 

Wanted Final Result:

col Acol Bcol Ccol D
A1appledd
A23bananadd
B3cherrycc
C4daisydaisy

 

THANKS!!

1 ACCEPTED SOLUTION
talbot
Regular Visitor

Hi nimblecat.

 

Is this the kind of thing you're looking for?

 

talbot_0-1664301560750.png

 

View solution in original post

2 REPLIES 2
wdx223_Daniel
Community Champion
Community Champion

=Table.AddColumn(TableA,"col D",each TableB{[#"col A"=[col A]]}?[col B]? ??[col C])

 

the values must be unique in col A of TableB .

talbot
Regular Visitor

Hi nimblecat.

 

Is this the kind of thing you're looking for?

 

talbot_0-1664301560750.png

 

Helpful resources

Announcements
Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors