Get previous date at matched column

I have “Harvest_Schedule” table like this, i create a "PRE-HARVEST DATE" as a virtual column and i want to get date, when i harvest that product last. And fill “PRE-HARVEST DATE” with that previous date.

KEY……PRODUCT…HARVEST DATE……_…_PRE-HARVEST DATE(Virtual column)
1_________Tomato__________01/05/2021________________null
2_________Banana__________05/05/2021________________null
3_________Tomato__________06/05/2021____________01/05/2021
4_________Tomato__________15/08/2021____________06/05/2021
5_________Banana__________20/05/2021____________05/05/2021

i try to do with MAXROW() and i get a error with that code;

MAXROW("Harvest_Schedule", "HARVEST DATE", ([PRODUCT]<[_THISROW].[PRODUCT]))

Would you please help me.

1 4 244
4 REPLIES 4

Why dont you just call the data from the column?
INDEX(SORT(Select(TEST[HARVEST DATE],([Product] = [_ThisRow].[Product])),TRUE),1)

MONTH/DAY/YEAR
is the date format*

Thank you. I tested that solution but it change all the tomato’s “PRE-HARVEST DATE” as a Max date. I want to keep previous date for each tomato row. And after i calculate how many days between last two harvests. Is that possible?

Then you have to assign an ID to each row if you want to keep every individual date or just

[key].[Harvest date]

, and I sugest the first one because is better structured and more easily scalable.
And about the date calculation, of course is doable

Top Labels in this Space