Ok, for full understanding then, when you enter the record “later”, which means its not in order, and edit the date, how do you know which other record you want to calculate the number of days from?
I understand what you are saying about extraneous columns. However, Virtual Columns, because of the fact they don’t store results, re-calculate each time a sync is performed. Your expression is performing TWO selects on EACH and EVERY row each time a sync is run. This is slowing the sync tremendously!!
But if you think about it, the Days value only needs to be re-calculated if the Date its based on changes.
If you were to simply make the Days column an actual column and then place your expression in that columns App Formula, you would see a significant improvement, 10-fold+, in the sync time.
I do also want to caution about the usage of RowNumber in your calculations.
It is not a stored value with the row, it is assigned as rows are loaded into AppSheet. I’m not sure how AppSheet loads rows, but typically we should never expect that rows are always loaded in the same order. If that is true, then the RowNumber value may not always be the same for a particular row in the data. In fact, AppSheet’s documentation strongly recommends against using RowNumber and I think it is for this very reason.
This is why I am asking the question at the top of this post. If it can be identified how to perform the calc without depending on row order…and implement the suggested column change…then you’ll be golden!!