Need help to compare data in current and previous row of a table

Hello. I am sorry for asking. Can you please help me?
I just need to compare if data in current row is equals data in a previous row of a table? For example i have a field “year” and i want to know is “year” of a current row is same as “year” in previous row. I tried everything but has no result. Can you please help me?