Reputation: 469
The sql I used to generate month and year is as below: left(CONVERT(VARCHAR(10), CLOSED_DT, 112), 6) AS MONTH The fomat of the Month and year is '201507'. How can I show fiscal year and month on horizontal axis? For example, 'Dec 2015' comes before 'Jan 2016'.
Upvotes: 0
Views: 228
Reputation: 1667
you have created a string, so it will be sorted alphabetically. Instead convert to the first day of the month:
DATEADD(month, DATEDIFF(month, '2000-01-01', CLOSED_DT), '2000-01-01') as MONTH
That can still be used for grouping, and it will be treated and sorted as a date. You can then format the Date as appropriate within the axis
Upvotes: 1