DEMO
Use a recursive CTE (Be sure to set max recursion option to the # of days you need the loop to process or 0 once you've confirmed no infinite loops exist. ) to generate all your days between max and min of your dates in datetable and then join this result to your datetable on date between range. using datepart on year and quarter of a cycledate we can get the appropriate quarter/year and then group.
I didn't pivot the results. Pivoting data is usually a display function and best left to those display tools crystal, BI, etc. It can be done in SQL and in in this case Dynamic SQL would be needed as the # of years is dynamic in nature. I choose not to to down that path as the Reporting tools can handle the dynamic nature of the data.
WITH
DateTable as (SELECT cast('2015-11-01 00:00:00.000'as date) startdate, cast('2018-06-01 00:00:00.000'as date) endDate union all
SELECT '2017-09-02 00:00:00.000', '2021-12-02 00:00:00.000' union all
SELECT '2016-01-02 00:00:00.000', '2019-01-02 00:00:00.000'),
CTE AS (SELECT Min(StartDate) StartDate, max(EndDate) EndDate FROM DATETABLE),
CTE2 AS (SELECT C.StartDate as RangeStartDate
, C.EndDate as RangeEndDate
, 1 CycleCount
, datepart(Q,dateadd(d,0,C.StartDate)) as Quarter
, datepart(m,dateadd(d,0,C.StartDate)) as Month
, datepart(YYYY, dateadd(d,0,C.StartDate)) as Yr
, C.StartDate as CycleDate
FROM CTE C
UNION ALL
SELECT RangeStartDate, RangeEndDate, CycleCount+1
, datepart(Q,dateadd(d,1,CycleDate)) as Quarter
, datepart(m,dateadd(d,1,CycleDate)) as Month
, datepart(YYYY, dateadd(d,1,CycleDate)) as Yr
, dateadd(d,1,cycleDate) as CycleDate
FROM cte2
WHERE datediff(d,RangeStartDate, RangeEndDate) >= CycleCount
)
SELECT DT.StartDate
, DT.ENDDate
, concat(yr,'-',Quarter) [YYYY-Q]
, count(*) as DaysInQuarter
, sum(case when Month in (10,11) then 1 else 0 end)as OctNovDays
, sum(case when Month in (12) then 1 else 0 end)as DecDays
, datediff(d,StartDate, EndDate) as DaysTotal
FROM CTE2
INNER JOIN DateTable DT
on CTE2.CycleDate between DT.StartDate and DT.EndDate
GROUP BY Quarter,DT.StartDate, DT.EndDate, YR
ORDER BY DT.StartDate, DT.EndDate, YR, Quarter
OPTION (MAXRECURSION 10000)
Giving us:
+----+---------------------+---------------------+--------+---------------+------------+---------+-----------+
| | StartDate | ENDDate | YYYY-Q | DaysInQuarter | OctNovDays | DecDays | DaysTotal |
+----+---------------------+---------------------+--------+---------------+------------+---------+-----------+
| 1 | 01.11.2015 00:00:00 | 01.06.2018 00:00:00 | 2015-4 | 61 | 30 | 31 | 943 |
| 2 | 01.11.2015 00:00:00 | 01.06.2018 00:00:00 | 2016-1 | 91 | 0 | 0 | 943 |
| 3 | 01.11.2015 00:00:00 | 01.06.2018 00:00:00 | 2016-2 | 91 | 0 | 0 | 943 |
| 4 | 01.11.2015 00:00:00 | 01.06.2018 00:00:00 | 2016-3 | 92 | 0 | 0 | 943 |
| 5 | 01.11.2015 00:00:00 | 01.06.2018 00:00:00 | 2016-4 | 92 | 61 | 31 | 943 |
| 6 | 01.11.2015 00:00:00 | 01.06.2018 00:00:00 | 2017-1 | 90 | 0 | 0 | 943 |
| 7 | 01.11.2015 00:00:00 | 01.06.2018 00:00:00 | 2017-2 | 91 | 0 | 0 | 943 |
| 8 | 01.11.2015 00:00:00 | 01.06.2018 00:00:00 | 2017-3 | 92 | 0 | 0 | 943 |
| 9 | 01.11.2015 00:00:00 | 01.06.2018 00:00:00 | 2017-4 | 92 | 61 | 31 | 943 |
| 10 | 01.11.2015 00:00:00 | 01.06.2018 00:00:00 | 2018-1 | 90 | 0 | 0 | 943 |
| 11 | 01.11.2015 00:00:00 | 01.06.2018 00:00:00 | 2018-2 | 62 | 0 | 0 | 943 |
| 12 | 02.01.2016 00:00:00 | 02.01.2019 00:00:00 | 2016-1 | 90 | 0 | 0 | 1096 |
| 13 | 02.01.2016 00:00:00 | 02.01.2019 00:00:00 | 2016-2 | 91 | 0 | 0 | 1096 |
| 14 | 02.01.2016 00:00:00 | 02.01.2019 00:00:00 | 2016-3 | 92 | 0 | 0 | 1096 |
| 15 | 02.01.2016 00:00:00 | 02.01.2019 00:00:00 | 2016-4 | 92 | 61 | 31 | 1096 |
| 16 | 02.01.2016 00:00:00 | 02.01.2019 00:00:00 | 2017-1 | 90 | 0 | 0 | 1096 |
| 17 | 02.01.2016 00:00:00 | 02.01.2019 00:00:00 | 2017-2 | 91 | 0 | 0 | 1096 |
| 18 | 02.01.2016 00:00:00 | 02.01.2019 00:00:00 | 2017-3 | 92 | 0 | 0 | 1096 |
| 19 | 02.01.2016 00:00:00 | 02.01.2019 00:00:00 | 2017-4 | 92 | 61 | 31 | 1096 |
| 20 | 02.01.2016 00:00:00 | 02.01.2019 00:00:00 | 2018-1 | 90 | 0 | 0 | 1096 |
| 21 | 02.01.2016 00:00:00 | 02.01.2019 00:00:00 | 2018-2 | 91 | 0 | 0 | 1096 |
| 22 | 02.01.2016 00:00:00 | 02.01.2019 00:00:00 | 2018-3 | 92 | 0 | 0 | 1096 |
| 23 | 02.01.2016 00:00:00 | 02.01.2019 00:00:00 | 2018-4 | 92 | 61 | 31 | 1096 |
| 24 | 02.01.2016 00:00:00 | 02.01.2019 00:00:00 | 2019-1 | 2 | 0 | 0 | 1096 |
| 25 | 02.09.2017 00:00:00 | 02.12.2021 00:00:00 | 2017-3 | 29 | 0 | 0 | 1552 |
| 26 | 02.09.2017 00:00:00 | 02.12.2021 00:00:00 | 2017-4 | 92 | 61 | 31 | 1552 |
| 27 | 02.09.2017 00:00:00 | 02.12.2021 00:00:00 | 2018-1 | 90 | 0 | 0 | 1552 |
| 28 | 02.09.2017 00:00:00 | 02.12.2021 00:00:00 | 2018-2 | 91 | 0 | 0 | 1552 |
| 29 | 02.09.2017 00:00:00 | 02.12.2021 00:00:00 | 2018-3 | 92 | 0 | 0 | 1552 |
| 30 | 02.09.2017 00:00:00 | 02.12.2021 00:00:00 | 2018-4 | 92 | 61 | 31 | 1552 |
| 31 | 02.09.2017 00:00:00 | 02.12.2021 00:00:00 | 2019-1 | 90 | 0 | 0 | 1552 |
| 32 | 02.09.2017 00:00:00 | 02.12.2021 00:00:00 | 2019-2 | 91 | 0 | 0 | 1552 |
| 33 | 02.09.2017 00:00:00 | 02.12.2021 00:00:00 | 2019-3 | 92 | 0 | 0 | 1552 |
| 34 | 02.09.2017 00:00:00 | 02.12.2021 00:00:00 | 2019-4 | 92 | 61 | 31 | 1552 |
| 35 | 02.09.2017 00:00:00 | 02.12.2021 00:00:00 | 2020-1 | 91 | 0 | 0 | 1552 |
| 36 | 02.09.2017 00:00:00 | 02.12.2021 00:00:00 | 2020-2 | 91 | 0 | 0 | 1552 |
| 37 | 02.09.2017 00:00:00 | 02.12.2021 00:00:00 | 2020-3 | 92 | 0 | 0 | 1552 |
| 38 | 02.09.2017 00:00:00 | 02.12.2021 00:00:00 | 2020-4 | 92 | 61 | 31 | 1552 |
| 39 | 02.09.2017 00:00:00 | 02.12.2021 00:00:00 | 2021-1 | 90 | 0 | 0 | 1552 |
| 40 | 02.09.2017 00:00:00 | 02.12.2021 00:00:00 | 2021-2 | 91 | 0 | 0 | 1552 |
| 41 | 02.09.2017 00:00:00 | 02.12.2021 00:00:00 | 2021-3 | 92 | 0 | 0 | 1552 |
| 42 | 02.09.2017 00:00:00 | 02.12.2021 00:00:00 | 2021-4 | 63 | 61 | 2 | 1552 |
+----+---------------------+---------------------+--------+---------------+------------+---------+-----------+