STOCK count over time

Hello Guys,

I need help calculating the stock amount of each product at the end of every month.
i’ve got a list of specific SKUs and its initial stock count at the beginning of the year, and another list grouping the sales amount.
The goal is to reduce the sales amount from the initial stock count and so on


here i’ve got the initial stock values at the beginning of the year (column estoqye)
image
and in this table i’ve got the sales amount of each month for each product id.

any ideas?
thx very much guys

Hi,
You could join your two tables by SKU and year so that the stock at the beginning of the year is present in every monthly row. You can use a Group Loop Start + Loop End to go through every product and year individually. Now inside the loop, you can use a Moving Aggregation node with cumulative sum aggregation on the sales amount column and subtract this cumulative sum from the stock at the beginning of the year. So something like this:

Group Loop Start (group by SKU and year) -> Sort by month -> Moving aggregation -> Math Formula -> Loop End

Kind regards,
Alexander

3 Likes

thx man, it worked perfectly

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.