I don’t see too much complication on this, maybe I am missing something…
Just start with a ‘Column Rename’ node for the weekly table’s column $Time of use$ as in the output: $week 41$, $week 42$.
Afterwards a sequential OUTER LEFT join in two steps with your ‘Route ID reference’ table. And a ‘Math Formula’ node at the end calculating the difference.
For the first part, @gonhaddock is absolutely right. In regards to the additional dynamic recalculation, I would opt for a Column Expression using column(numberOfColumns() - 3 ) - column(numberOfColumns() - 2)
Week 41 and 42 are in the upper table, week 43 is joined from the lower table. After the join however, week 43 becomes the last column directly after the difference column which is somewhat inconvenient.
With a Column Resorter, I set the difference column to last position and any new column in front to adjust the order.
Based on this, the new week will always be in the -2 column from the right and the week before that in the -3 position. With numberOfColumns() you can get the total number of columns (5 in this case).Note that the column index starts with 0.
The column() function takes the values based on the column index, something that we have just established with the offset.
As such, applying the nested function column(numberOfColumns() - 3 ) - column(numberOfColumns() - 2) will give you the difference between week 43 and week 42. This translates to 23-10 = 10. Note: don’t forget the replace column checkbox for the difference so that it’s updated.