# Month on Month Comparison/Difference

Hi. I have a MoM data where I need to compute for the difference of current month to previous month. Ie, For Jan2022 it should be Jan 2022-Dec 2021 values. Note that my months are dynamic - An output can have Dec 2021, Jan 2022 months today, then for next month it will have Dec 2021, Jan 2022 and Feb 2022… and so on.

Any suggestions will help. Thanks!!

Hi @cjmmilante , we’ll need more information.

1. How is the data being given? Excel Files?
2. Will there always be 3 months?
3. Would the 3 months be sorted (as in oldest month left, newest right)?
4. Would the columns always be in the same position (B, D, E)?

FYI, you can access columns by position, regardless of their names, via the Column Expressions node, using the column() function.
column(0) would be for the first column
column(1) would be for the second column
column(2) would be for the third column
etc

Assuming that the answers are “Yes” for all of my questions above, then you do what you need in 2 expressions:
column(3) - column(1)
and
column(5) - column(3)

In the future, please provide sample data that we can import or copy-and-paste in our workflows. Noone will go and manually type from what you have in your screenshot into a table.

1 Like

Hi, Bruno. Thank you for your response.
I am dealing with dynamic columns. So for today, I’ll be dealing with Dec 2021 until Dec 2022.
It will always be 13 months, located in the same position (column).

The data is driven from Excel files - Previous data is fed thru Excel file, current month is added in the previous data. For example, Previous data in the excel file contains Dec 2021 to Oct 2022. Nov 2021 will be joined with this excel file thru KNIME.

Afterwards, I’d need to get the MoM difference as above.

Attached is the sample data, with the highlighted cells as the MoM difference.
Book2.xlsx (14.4 KB)

Hello @cjmmilante
You may find useful to have a look to the following topic; I think you may get insights from it:

BR