# Mean of the n lowest consecutive hours

Hi,

i have a dataset with hourly consumption data. I need the mean result of the lowest 8 consecutive hours in the weekend. With Group by node it´s easy to get the mean of the hole weekend but how i can get mean of the lowest 8 consecutive values?

Short example (only one day of data):

|Timestamp|Value|
|22.10.2022 00:00|200|
|22.10.2022 01:00|300|
|22.10.2022 02:00|400|
|22.10.2022 03:00|500|
|22.10.2022 04:00|300|
|22.10.2022 05:00|100|
|22.10.2022 06:00|50|
|22.10.2022 07:00|40|
|22.10.2022 08:00|40|
|22.10.2022 09:00|30|
|22.10.2022 10:00|100|
|22.10.2022 11:00|40|
|22.10.2022 12:00|40|
|22.10.2022 13:00|50|
|22.10.2022 14:00|100|
|22.10.2022 15:00|200|
|22.10.2022 16:00|300|
|22.10.2022 17:00|400|
|22.10.2022 18:00|500|
|22.10.2022 19:00|300|
|22.10.2022 20:00|200|
|22.10.2022 21:00|100|
|22.10.2022 22:00|100|
|22.10.2022 23:00|200|

Mean of the bold values is 48,75

Best
Jan

OK found the solution for my own. First create a new column with the Moving Average node and Group by on this column with min aggregation.

1 Like

Hi @morpheus2010 and welcome to the KNIME community forum

One possible solution is to use a moving average window to calculate the lowest 8 average position within your “Value” column. Then, keep only the lowest value using the -GroupBy- node.

There are two nodes for this in KNIME but only the more advanced -Moving Aggregation- node allows EVEN size sliding windows, i.e. 8 as in your case.

Hope it helps.

Best

Ael

PS 1: I didn’t see your previous post since I was already writing mine. Yes, it is exactly that.

PS 2: Thanks @takbb for the great component you implemented to convert data from the forum into a table. It works like a charm !

3 Likes

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