Calculation of price with inventoring and FIFO rule
I have number of purchased kilograms of item with different price and also I have number of sold kilograms of item with buying and selling dates respectively. I would like to evaluate avg price per kilo on the date of discharge with the rule of First In First Out.
Table with example attached.
Anyone knows how to calculate discharging prices in table above? I tried to use accumulation by previous dates as a part of solution, but still cannot do that task.