Hi, I am trying to figure out how to best replicate the following excel function (which goes for the whole column) in a Column Expression node, which I think might be my best bet. The following function is located in column B, showing three row’s worth

=IF(X2=2023,IF(A2<>A1,1,IF(X1=2023,0,1)),0)

=IF(X3=2023,IF(A3<>A2,1,IF(X2=2023,0,1)),0)

=IF(X4=2023,IF(A4<>A3,1,IF(X3=2023,0,1)),0)

Column X contains either 2023 or 2022 in every cell and column A consists of a six digit identifier that has been sorted ascending but may appear multiple times, which the formula works with.

Not a javascript user but after looking at a bunch of other forum submissions, I have been trying to figure out using if functions in Column Expression and possibly using a column offset function to refer to the previous row in the same way the original excel formula does but not able to wrap my head around it - any brighter minds with better ideas?