fix total calculation for empty dataset