added calculation of total to analyseData