Moving Agreggator - product movig historical values (stock item)

Hi Friends,
I would like some help.

I’m creating this workflow to calculate the product consumption from Selling and return.

I have a selling product table with return values. (BLUE)
Selling values is positive, and return is negative

I have another table that shows the initial values that the company have in Stock por each product. (ORANGE)

I create a Group loop start to iterate over product and JOIN (PINK) with the 'initial" table values, to only show 1 row and then use the table row to variable

What i need!!
I need to iterate and calculate the historical value starting from initial stock by -_id_product util the last Invoice.

See green colum for result

Talking about variable, is like I need to overwrite the initial value after de first iteration and store that value to use it again for the next iteration and so on.

Iteration 1
initial_value_variable é equal = 5
Then, invoice is -1 = Then SUM initial_value_variable + -1 = initial_value_variable = 4

Iteration 2
initial_value_variable é equal = 4
Then, invoice is 1 = Then SUM initial_value_variable + 1 = initial_value_variable = 5

My initial values needs to be dynamic
Moving aggregator_Initial_Values.knwf (28.3 KB)

I’m trying to use “propagate modified loop variables”, but it’s not working.

I’m search in the forum, somthing similar to my case, but until nothing,

I did it.
O saw this and solution from @takbb with similar problem (but I not finding).

The name of my post should be like: changing variable values on It iteration

Moving aggregator_Initial_Values.knwf (29.6 KB)


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