I have a table (say orderlines) with orderrows, There is a column that holds the "Year" of the orderline.
I like to write a userdefine function that calculate how many years in a row that item has been sold from today and back.
For examle :
If I in the table have:
The result is two year (since 2017 is not in a row)
IF I have
the result is 0 because it is not sold 2020
How can I accomplish this?