When you need to read from the whole table where that row is, you need to use some of those expressions and can’t avoid it. One option is to use an additional normal column and read that column’s value from the previous row. And because it’s read with the initial value, it doesn’t matter.
Not sure why you are getting that error… Below is the same expression used in an app I have that doesn’t produce that error. Is this in a virtual column? Or are you using it somewhere else?