Group by Year and Date

Is there a way I can group first by year then by month of a date field or some combination?

Or is there a way to duplicate the date field if it’s used as a column or row to then be used again as a further grouping? So on filterData copy the date fields in the data set and then reset data using setData?