Calculate max. tim in row for timetable

I have a table with a list of films. In the Duration column are the values in minutes. The films are already sorted by rating.
Now I need to pull the top-rated films, which together last 1080 minutes, from the table - without changing the order.
Any ideas?

Hi @tschaipi and welcome to the KNIME community.

If I have understood correctly, you want to find the first n films from your sorted data which together have a running time of up to 1080 minutes. Is that what you meant?

If that is the case, then you need to create a new column containing the cumulative sum of the runtimes, which can be performed using the Moving Aggregation node. This will give the cumulative run times for each film from first to last. Then you could use a Row Filter to return just those rows where the cumulative run time is between 0 and 1080.

An example of Moving Aggregation to calculate the cumulative sum can be found here:

I hope that helps

3 Likes

That just did the trick, thanks a lot!

1 Like

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