You can run R scripts from Power BI. There are R packages to model and solve problems like this. I would start by developing a mathematical model for this problem. That makes it easier to select a suitable package.
I have a problem which works to a degree in Excel using solver. However, I do not know how it can be done within Power BI*
What I essentially want to do is distribute/reallocate volume across several categories.
Example:
I have 5 warehouses all working at different productivity efficiencies.

Warehouse A = 90 throughput rate per hour - Max Capacity 1,200,000
Warehouse B = 85 throughput rate per hour - Max Capacity 800,000
Warehouse C = 100 throughput rate per hour - Max Capacity 2,200,00
Warehouse D = 75 throughput rate per hour - Max Capacity 1,000,000
Warehouse E = 95 throughput rate per hour - Max Capacity 1,100,000

I have 5,000,000 units of volume that I need to distribute to these 5 warehouses. The idea is to reduce cost so the most efficient warehouse should get as much of this volume until it hits its maximum capacity after which it moves to the warehouse with the second best throughput rate.
So in this example Warehouse C will get allocated as much volume as it can take before they hit their max capacity. Then it will move to warehouse E, then Warehouse A. The algorithm should stop as soon as the 5,000,000 units are used up.
(Cost is calculated using the cost per labor hour £15. i.e Volume (units) / Throughput rate = Hours ; Hours * £15 = £ Cost)
Is there a way to do this?
Power Bi - Solver Function