# Need to run a loop for each row of the table

Hi All,
I need to do a calculation “Count of Months to utilize Stock” in a table in Quicksight. “Count of Months to utilize Stock” is the months taken to utilize all the stock available for each month as shown in the Result Table.
Explanation of the data in “Result table”:

Date : Date aggregated on month level
Stock: Stock or inventory available in the given month
Sales Forecast: Forecast of the sales for each month. This field will be used to identify the “Count of Months to utilize Stock”
“Count of Months to utilize Stock”: It is the months taken to utilize all the stock available for each month.
For Example: “Count of Months to utilize Stock” for Jan month: (30000-(123137+105118+69543)) in this cal stock will be finished in 3 months so “Count of Months to utilize Stock” is 3
Feb month: 128 - (105118+69543) in this cal stock will be finished in 3 months so “Count of Months to utilize Stock” is 3

I am attaching an excel that contain the Result table and a table to show how to calculate the “Count of Months to utilize Stock”. Please take a look and let me know if you need more information.