How to do calculation referencing previous row value in the same vector?

Same principle. Also, screenshots are unhelpful. See the FAQ: How to do a minimal reproducible example (reprex for beginners