Hi all.
I would like to get one aggregate table from the billing and incoming payments table, where the incoming payments should be assigned to the contracts with the earliest due dates (payment deadlines) and according to the priority of the incoming payment.
I have tried to solve it with Power Query, received one good solution (community.powerbi.com/t5/Power-Query/Aggregate-table/m-p/2935558#M92692), but it was not possible to take into account the priority of the incoming payment.
I suppose it is possible to solve it with VBA.
As I am new to VBA and would be very grateful for your help.
Attached is the excel file with initial table, results and with a description.
Here is also a description:
We first select the payments with priority 1 on 27.02.2022, 28.02.2022, 02.03.2022.
A payment of 50 under contract 1 on 27.02.2022 will cover partly the amount of 100 from 02.02.2022 with a due date of 15.02.2022.
A payment of 150 under contract 3 on 28.02.2022 will*cover partly the amount of 200 from 03.02.2022 with a due date of 15.02.2022.
And a payment of 50 under contract 5 on*02.03.2022 will cover*partly the amount of 100 from 10.02.2022 with a due date of 24.02.2022.
After that we select the payment with priority 2. This is a payment of 100 under contract 1 on 26.02.2022 which will cover the rest of the amount of 100 from 02.02.2022 with a due date of 15.02.2022 and partly the amount of 500 from 13.02.2022 with a due date 07.03.2022.
Than the payment with priority 3 comes into play. This is a payment of 50 under contract 5 on 03.03.2022 which will cover the rest of the amount of 100 from 10.02.2022 with a due date of 24.02.2022
Under priority 4 we have a payment of 200 under contract 2 which will cover partly the amount of 300 from 08.02.2022 with a due date of 22.02.2022.
And finally we have the payment of 350 with priority 5 under contract 4 which will cover partly the amount of 400 from 05.02.2022 with a due date of 19.02.2022.
If you have any ideas also how to do it in Power Query - I will be also very grateful for that.
Bookmarks