I've got transaction data spanning 3 years and I would like to report on performance for the different years on a Year-To-Date basis.
The data is like:
REP_NAME : SECTION : AMOUNT : DATE
Mark : Sec1 : 2,000 : 01/10/2016
Jane : Sec2 : 1,400 : 02/12/2017
And so on...
What I want to do is write a query that will group all the amounts per year but being controlled by the current date of the current year.
2016 : 2017 : 2018
2500 : 2300 : 3400
Showing, YTD for 2018 is 3400 (i.e. between 01/01/2018 - 29/03/2018), but same period the last two years (between 01/01/2017 - 29-03-2017) and (01/01/2016 and 29/03/2016) the collection was 2,300 and 2,500 respectively.
I hope this is clear. I am using Oracle Database.
Thanks.