# Loop over unique rows in KNIME

Hello,
I am very new to KNIME and I have a simple question.

How to iterate through rows with unique values and perform some formula on them? For example, i have a dataset:

Fruit~ Amount, Price
apple 2 1\$
apple 3 1\$
banana 1 1.5\$
apple 1 1\$
banana 3 1.5\$
apple 1 1\$
strawberry 5 3\$
strawberry 4 3\$
banana 2 1.5\$

I would like to iterate through each row of the āFruitā column and to calculate [Amount*Price] and save the result for three different fruit types in in three different tables.

How to tell KNIME that he needs to calculate [Amount*Price] only for bananas, or only for apples, or only for strawberries separately? Which iterator can i use here? I need to know how to do it with Loop iterator.

Im thinking something like: LOOP --> Math Formula --> save separate CSV.

Hi there @Milovanova,

welcome to KNIME Community!

You are on the right path and loop node you are looking for is Group Loop Start.

To write separate CSV file in each loop iteration check this example workflow from KNIME Hub:

Happy KNIMEing!

Br,
Ivan

2 Likes

Hello Ivan,

a little recap on my problem, what if i do not want to save each time the result in a separate table, but instead i want to create ONE table (called [Result]) and constantly update it?

For example, 1) I calculate [AmountPrice] for babanas and put the results into a āResultā table, --> then, 2) I do the same for apples, [AmountPrice], and would like to UPDATE the āResultā table, meaning I want to add the rows of the apple multiplication results just right after banans multiplication results.
So that my table would look like:
[Result]
1.5\$ ((bananas)
4.5\$ (bananas)
3\$
3\$
1\$
ā¦ etc

P.S: in the āResultsā table i donāt need what I wrote in the brackets, I just need the multiplication result.