Sum Multiple items if condition met

This is a document library. I’m trying to have calculations in two fields using xslt that will sum the amounts in yellow (first year numbers). I also only want to be able to see one entry for each team. Any suggestions.
graphical representation of what my intent is.