Quantcast
Channel: Power Query topics
Viewing all articles
Browse latest Browse all 31097

Power Query: calculate and use result in the next row

$
0
0

Hello everyone

 

I need to calculate a stock forecast (colums Qty and Amount) like in this excel file https://file.io/pnGmx7f0m9iG  

Calculation is done by Material with a sort by YearMonth or Row Number.

The first row can have a stock qty and amount or not.

Each next row is using stock qty and amount from previsous row.

The logic is tricky because the sales amount does not exist and is calculated in the Amount column. Its unit price corresponds to (StockAmount + PurchasingAmount) / (StockQty + PurchasingQty).

 

In the excel file, in red I, virtually copy stock qty/amount to the next row to keep same formulas than first row.

 

I need to do this in Power Query, not in Power BI.

 

I have tried to use the logic from several articles but I struggle to manage it working.

 

Thanks a lot in advance for your help.

Christophe


Viewing all articles
Browse latest Browse all 31097

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>