compute the total ams and the ams by group in analyse