I think the number of days per quarter can be all done from fields in D1.
I first converted the month into a proper date:
Then used window calculations to get the first and last months of the quarter:
WINDOW_MIN(MIN([Convert to Date]))
likewise: WINDOW_MAX(MAX([Convert to Date]))
Then the number of days per quarter can look something like this:
DATEADD('day',-1,DATEADD('month',1,[MaxMonthQuarter]) ) ) +1
// difference between first day of quarter and one day before beginning of next month)
Please see workbook attached in the Forum Thread.