unitlist with custom header using values from current group

I want to create a view like the unitlist, but the group header should contain a calculated value.
For example:
groupby year and show the number of items that have this year.

the templateheader only returns the group by value and not the subitems.

Should I use another component?