So I'm gathering 3 month intervals using Date_Year and Date_month columns but having some issues
For example, the first group is Oct-Dec 2016 which is fine. The second group is the one I'm having trouble with , Nov-Dec 2016 along with Jan 2017..
Here is the sample code:
SELECT
[2016_Oct_Dec] = SUM(CASE WHEN date_year = 2016 AND date_month IN
(10,11,12) THEN Sales_amt END )
, [2016/17_Nov_Jan] = SUM(CASE WHEN (date_year = 2016 AND date_month IN
(11,12)) AND ((date_year = 2017 AND date_month = 1))
THEN Sales_amt END )
From Sales
I tried to create two conditions (Nov-Dec 2016) and (Jan 2017) but no luck.
Any help appreciated.
