Looping for quantity balance per SKU

Hello guys,

I have flow that has two tables:

  1. Wanted quantity: a list of sku’s and quantity that wich I want to consume from other table: 2.Quantity avaible (wich has the same skus but in different quantity ( is my stock per SKU).

First of all, there some skus that has a row with its quantity greater than one, so I’ve splited both tables in order to have a row per quantity.

After that I want inquiry stock availability crossins table 1 vs table 2, if has availability I want to include a balance column afterwards quantity consuption for each line. To do that I made a join then a filter to get the first row to do the consuption, but I need to include o looping in order to check all rows in table 2 and update its balance.

Sorry abou my english, I hope I it is clear.Loop.knwf (90.4 KB)

Hi @rafaelfre

I had a look at your workflow, but I’m afraid it’s not really clear to me what you want to do there, I’m sorry. Maybe you can specify which column from which table you want to compare?



What if you first with group by find the min or max quantity per SKU and then join the two tables and then calculate the difference between the wanted and available quantity … then filter the quantity you need

Loop new.knwf (103.6 KB)

Hi Alice, let me try to explain better:

This is my first table which has quantity I want to consuming from my stock table. First colun is my Asset number, second SKU and third my quantity. I’m not allowed group those lines just split…


the second is my stock table which has my quantity avaible per SKU, First colun is my Asset number (it’s doesn’t need to match with the asset of the first table), second SKU and third my quantity. I’m not allowed to group those lines just split…


I want to set a loop at get all lines from my first table and consuming from my stock. Then give the consumed rows, not consumed rows and not availbe stock rows, bellow my spected result.

Tks in advance for the attention.

tks, Andre.
Maybe I couldn’t clear in my question, please see at my reply to Alice more datails.

tks for your job and time. :wink:

Hi @rafaelfre

thanks for the explanation. I am still not sure if I completely understood it, (i.e. the loops and on which column you are merging the tables) but I attached you a workflow that maybe/hopefully does what you want.
Looping for quantity balance per SKU.knwf (88.6 KB)

Let me know if that does the job for you.


In this partof my work flow, I’ve splitted all lines per quantity from my first table (quantity I want to consuming of my stock, second table):

At second part I made the same, I’ve spitted all lines per quantity…

Now, what I want to do…like a stock controle, at the second table I has my available quantity in my storage (stock) and the first quantity I need to consuming of my stock…

I need to join by SKU, but just when the sku from my stock table (second table) has available quantity to consuming (balance)…so for the two first rows above I’ve write off from my stock 2 units, one per line, therefore my balance is zero.

For lines 3 and 4 above (sku 12.34), I have two units available yet, because they weren’t consumed from my first table. so I have a balance of 2 one per row

for lines 5 and 6 (sku: 43.3) I’ve written-off from my stock 2 units, one per line, therefore my balance is zero. It was written-off from: “ATIVO” 3ZZ from first table.

for forth last lines, I need some quantities (first table), but I don’t have in my stock (second table).

tks a lot for your time :wink:

Hi @rafaelfre

how about grouping by SKU and ATIVO then, like andrejz suggested earlier? That’s at least what I would do now to get quantity per item from the first table…


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