Average on the last x-number of columns

Hi, I'm  having trouble in calculating an average.

I know it's simple using the mathformula node and the formula "average", but my problem is that I won't have always the same columns, I mean sometimes I might have 20, sometimes 24, etc.. and not always the same names on it, so what I'm trying to do is to give Knime the instruction of calculating an average from the last x-number of columns, regardless its names.

Does someone has an idea on how I can manage to do this in Knime?

Thanks in advance for your help, any comments will be helpful.

Can you provide an example? What I have done in the past when the column names change, is to create a list of column names (you can also filter the names) and convert them to flow variables that I can use in the nodes.

If all the columns you want to use are numbers, AND there are no other number columns, you could filter the columns by type, then extract header, then use the column names to pivot the data. So instead of having:

Nov 2016 | Dec 2016 | Jan 2017
50 200 30

You have:

Month | Value
Nov 2016 | 50
Dec 2016 | 200
Jan 2017 | 30

Then you could convert the data to “date” and filter using time series extract. Group by: Manual aggregation: Mean.