Merging rows based on dates (multiple rows have same date but different data)

isafu

New Member
Joined
Sep 13, 2022
Messages
4
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
POWER QUERY HELP ENGLISH.jpg

Hi, I'm very new at using Power Query, I would appreciate any pointers / guide to solve this case

Data source are two different table, purchase and production

I need to make a report table based on date, as shown on the bottom right table


What I have tried:

Using unpivot

Result:

Expression.Error: There weren't enough elements in the enumeration to complete the operation

Thank you!
 
Well I finally got there too. It's a good thing I didn't refresh my web browser sooner to see the fantastic solution from @JGordon11...I would have given up. Well done! Mine is much less efficient and much longer. I'll need to spend some time dissecting the code to see how this was done. I invested a lot of effort into developing a scheme for determining how many items on each date can be paired and which ones will exist only as singletons. And to keep all of the intermediate results organized, I split the query into multiple queries, so it's long and more convoluted, but it is available here should anyone wish to review/try it.
My pairings happen to be the same as those shown by @JGordon11.
MrExcel_20220915_isafu.xlsx
ABCDEFGHI
1Table ATable B
2Purchased (P)Used (U)
3
4CodeDatePurchase QtyLocationCodeDateProductQty Used
518/1/2022100WalMart18/1/2022Bread30
618/1/202250Target18/1/2022Biscuits10
718/2/202250Target18/2/2022Cookies15
818/3/202220WalMart18/2/2022Brownies10
918/3/202220Target18/3/2022Bread30
10
11
12Results
13
14CodeDateProductQty UsedPurchase QtyLocation
1518/1/2022Biscuits1050Target
1618/1/2022Bread30100WalMart
1718/2/2022Brownies10
1818/2/2022Cookies1550Target
1918/3/202220Target
2018/3/2022Bread3020WalMart
Sheet1
 
Upvote 0

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Thanks for taking a look at this, Kirk :)

I was trying multiple queries but got nowhere with it, I've done similar by aggregating numeric data but couldn't see that it would be possible with text fields.
I think I need to study @JGordon11's method as well, looking at the amount of code used, I think that I was trying to seriously over complicate the task.
 
Upvote 0

Forum statistics

Threads
1,225,378
Messages
6,184,621
Members
453,249
Latest member
gmazee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top