Power query group by/merge question

danhendo888

Board Regular
Joined
Jul 15, 2019
Messages
142
Office Version
  1. 365
Platform
  1. Windows

Book1
ABCDEFGH
1VendorOrder RefCreation DateTotal PO AmountPO CurrencyDocumentPayment AmountPayment Date
21000010034B111111112/24/2018191.78USD5100006334203.841/17/2019
31000010034B111111112/24/2018191.78USD00.00
41000010034C11111112/4/2019400.00USD00.00
5
6Desired output:
7
8VendorOrder RefCreation DateTotal PO AmountPO CurrencyDocumentPayment AmountPayment Date
91000010034B111111112/24/2018191.78USD5100006334203.841/17/2019
101000010034C11111112/4/2019400.00USD00.00
Sheet1
<p style="width:8em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid rgb(187,187,187);border-top:none;text-align: center;background-color: rgb(218,231,245);color: rgb(22,17,32)">Sheet3 (2)</p><br /><br />

How can I reduce the first table into the desired output using Power Query?
Not sure how to deal with the zeroes.
Line 3 is created when I book the invoice
Line 2 is created when the invoice is paid
So in essence, for that particular invoice B1111111, I only need to see Line 2 in the output
 

I suggest to check your M-code for this source data:

VendorOrder RefCreation DateTotal PO AmountPO CurrencyDocumentPayment AmountPayment Date
1000010034​
B1111111
24/12/2018​
191.78​
USD
5100006334​
203.84​
17/01/2019​
1000010034​
B1111111
24/12/2018​
191.78​
USD
0​
0​
1000010034​
C1111111
04/02/2019​
400​
USD
0​
0​
1000010035​
D222
01/05/2019​
222.55​
USD
666667​
543.8​
01/06/2019​
1000010035​
D222
01/05/2019​
222.55​
USD
0​
0​
1000010035​
D222
10/10/2019​
123​
USD
0​
0​

result is:

VendorOrder RefCreation DateTotal PO AmountPO CurrencyDocumentPayment AmountPayment Date
1000010034​
B1111111
24/12/2018​
191.78​
USD
5100006334​
203.84​
17/01/2019​
1000010034​
C1111111
04/02/2019​
400​
USD
0​
0​
1000010035​
D222
01/05/2019​
222.55​
USD
666667​
543.8​
01/06/2019​

but IMHO should be:

VendorOrder RefCreation DateTotal PO AmountPO CurrencyDocumentPayment AmountPayment Date
1000010034​
B1111111
24/12/2018​
191.78​
USD
5100006334​
203.84​
17/01/2019​
1000010034​
C1111111
04/02/2019​
400​
USD
0​
0​
1000010035​
D222
01/05/2019​
222.55​
USD
666667​
543.8​
01/06/2019​
1000010035​
D222
10/10/2019​
123​
USD
0​
0​
 
Upvote 0

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Yeah, the OP was confusing to me and I'm not really sure if my code is correct or not. It was too small of a sample data set and desired results.
 
Upvote 0
your code works for single set but with more data (as you can see) it doesn't
 
Upvote 0

Forum statistics

Threads
1,213,506
Messages
6,114,025
Members
448,543
Latest member
MartinLarkin

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