03Explorer
Technical User
I need to generate a report that counts incidents per month. But the catch is from month to month (months sorted ascending) need to include previous months totals). example chart below
Aug 03 =1
Sep 03 =2
Oct 03 =2
Nov 03 =3
Dec 03 =4
Jan 04 =8
Feb 04 =8
...
I am using one field, a date field. I am including my SQL code that I am trying to figure this out with.
I extracted the year and month for sorting purposes.
Thanks
Aug 03 =1
Sep 03 =2
Oct 03 =2
Nov 03 =3
Dec 03 =4
Jan 04 =8
Feb 04 =8
...
I am using one field, a date field. I am including my SQL code that I am trying to figure this out with.
Code:
SELECT
Format([cons_date],"yy") AS sort_year,
Format([cons_date],"mm") AS sort_month,
Format([cons_date],"mmm") & " " & Format([cons_date],"yy") AS Consent_date
FROM
DBA_mem_us_baseline AS m
ORDER BY
Format([cons_date],"yy"),
Format([cons_date],"mm");
I extracted the year and month for sorting purposes.
Thanks