Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Query
Unanswered

Power Query Merge based on conditions

(0) ShareShare
ReportReport
Posted on by

Hi everyone,

 

I am trying to merge two tables, and I think I need to do the merge based on conditions.  The first table is a list of all finished inventory, which includes the end customer name, city and state.  The second table is a list of customers and which warehouse each should go to.  I want to use Power Query to add the warehouse to the inventory listing.  (I am currently using an Excel formula, but the inventory list is long and performance is very poor.)  The issue is that our criteria for sending material to a warehouse can vary by customer, as shown in the image below.  How can I set up a merge with the following conditions?

- If the customer list specifies the customer name only (city shows 'all' and state shows 'all') then merge based on the customer name only

- If the customer list specifies the customer name and state (and city shows 'all'), then merge based on the customer name and state

- If the customer list specifies the customer name, city, and state, then merge based on all 3 fields

 

CustomerCityStateWarehouse
ABC Co.DenverCOW1
ABC Co.BoulderCOW2
DEF Co.allallW3
GHI Co.allOHW1
GHI Co.allWAW2

 

Desired Result:

Serial NoProductCustomerCityStateWarehouse
1234Blue bikeABC Co.DenverCOW1
1235Red bikeABC Co.DetroitMI<blank>
1236Green bikeXYZ Co.New YorkNY<blank>
1237Blue bikeGHI Co.ClevelandOHW1
1238Red bikeDEF Co.TaylorMIW3
1239Green bikeGHI Co.New YorkNY<blank>

 

All help appreciated!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Power Query

#1
mmbr1606 Profile Picture

mmbr1606 9 Super User 2025 Season 1

#2
stampcoin Profile Picture

stampcoin 7

#3
SD-13050734-0 Profile Picture

SD-13050734-0 6

Overall leaderboard

Featured topics