this is a little bit complex because of the rules with respect to previous rows. I attach you the simplest solution, which loops over the ItemCode and than fixes the missing value only in this group.
Another solution would be to use the LAG column node to shift the previous values into the same row and than use the rule engine node or the Column Merger node, to resolve the missing values.
Don’t know your exact requirements so I have couple of notes for this and similar use cases:
in case your data is grouped like in above example you should use loop (Group Loop Start node) which will iterate over group of rows in order not to mix values in between groups
Lag option in Lag Column node needs needs to be set up according to the number of missing values possible in succession (this can be a bit tricky) in order not to replace missing values with just another missing value. It will produce multiple lagged columns and then logic is needed in Rule Engine node to take proper value
in case you need special logic about missing value like in example before (sometimes using previous and sometimes next row) two (or more) Missing Values nodes with different settings should be used