Hi everyone,
We have a dataset containing two columns Date, Id and Value.
We are using the lag function to get the value from the previous financial year.
i.e.
lag(Date, 364) over (partition by Id order by Date)
Wondering how we could use this to get the previous date the year before but matching on the date.
So 1st Feb 2018 compares to 1st Feb 2017. We can't just do 365 as the offset as that would be wrong for some years.
We have used the date dimension stuff to stack the data but for this use case we need the values on the same row.
Thanks