How to Fix this resource planning with PQ? Recursive function/loop?

crise

New Member
Joined
Mar 6, 2016
Messages
2
Let's say I have below table. I'm wondering if there is a way in Power Query to fix this planning.

The order of processes should be first by priority, and then by date.
As you can see, there is a problem on 11-1-2021 to 15-1-2021, where the resource usage is 175%.
I would like to move al processes forward in time that are conflicting, while respecting the desired order of the processes. Obviously processes of 25% and 75% could run on the same day.

Below things come to my mind that could be part of the solution, but I don't know how to make cake of it.
  • Group by Date and sum Resource usage shows me the conflicts.
  • Merging with a date table and calculating resource availability for each day.
  • Using a recursive function?
  • Using a loop?
I know it's perhaps more straightforward to do this with VBA, but I would really like to learn if something like this is possible in PQ.

ProcessDateResource usagePriority
A1-1-2021100,00%3
A2-1-2021100,00%3
A3-1-2021100,00%3
A4-1-2021100,00%3
A5-1-2021100,00%3
B6-1-20210,00%3
B7-1-20210,00%3
B8-1-20210,00%3
B9-1-20210,00%3
B10-1-20210,00%3
C11-1-202175,00%3
C12-1-202175,00%3
C13-1-202175,00%3
C14-1-202175,00%3
C15-1-202175,00%3
D16-1-20210,00%3
D17-1-20210,00%3
D18-1-20210,00%3
D19-1-20210,00%3
D20-1-20210,00%3
E21-1-202125,00%3
E22-1-202125,00%3
E23-1-202125,00%3
E24-1-202125,00%3
E25-1-202125,00%3
F6-1-2021100,00%2
F7-1-2021100,00%2
F8-1-2021100,00%2
F9-1-2021100,00%2
F10-1-2021100,00%2
G11-1-20210,00%2
G12-1-20210,00%2
G13-1-20210,00%2
G14-1-20210,00%2
G15-1-20210,00%2
H16-1-202175,00%2
H17-1-202175,00%2
H18-1-202175,00%2
H19-1-202175,00%2
H20-1-202175,00%2
I21-1-20210,00%2
I22-1-20210,00%2
I23-1-20210,00%2
I24-1-20210,00%2
I25-1-20210,00%2
J26-1-202125,00%2
J27-1-202125,00%2
J28-1-202125,00%2
J29-1-202125,00%2
J30-1-202125,00%2
K11-1-2021100,00%1
K12-1-2021100,00%1
K13-1-2021100,00%1
K14-1-2021100,00%1
K15-1-2021100,00%1
L16-1-20210,00%1
L17-1-20210,00%1
L18-1-20210,00%1
L19-1-20210,00%1
L20-1-20210,00%1
M21-1-202175,00%1
M22-1-202175,00%1
M23-1-202175,00%1
M24-1-202175,00%1
M25-1-202175,00%1
N26-1-20210,00%1
N27-1-20210,00%1
N28-1-20210,00%1
N29-1-20210,00%1
N30-1-20210,00%1
O31-1-202125,00%1
O1-2-202125,00%1
O2-2-202125,00%1
O3-2-202125,00%1
O4-2-202125,00%1
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Forum statistics

Threads
1,223,723
Messages
6,174,123
Members
452,546
Latest member
Rafafa

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