Calculate an Average If the value is Greater than Zero

Hello everyone,

I´m new in Knime, I´m trying to do some things I normally do in Excel, this time I want to do an "averageif" in  rows.

What I need to calculate is the average value in a row with only values greather than zero, for example

0,1,3,-1 = average = 2

3,-2,0,7 = average = 5

So I found a column aggregator node that calculate the average value in a row, but the thing is that I didn´t found an option to not count the values Lesser or equal to zero so I have 2 Questions.

1. Is there a node that could make this calculation?

2. I think one way to do the operation with the column aggregation node is to convert values Lesser or equal to 0 to missing values and average them but... how could I replace these values to missing values?

Id be grateful for any help.

Thanks.

AC

Hi Andrea,

please find attached a workflow that should solve your problem. 

Hope this helps,

Best,

Vincenzo

Hello Vicenzo,

 

Thanks for the response it actually helped a lot!, I added something for the example since the data came like this: 

ID WK1 Wk2 WK3 WK4
1 3 0 4 2
2 5 6 2 3
3 0 0 5 4

Since I have to calculate the average by total WK and by ID if the value is greater than 0 then I applied an Unpivoting Node to convert the WK headers to Rows and then I did the example you sent.

Thanks a lot.