Do a full course backup then restore into a new course.
Comment from Elena Ivanova in
Issue happens if you have SUM somewhere. In the restored course the category/course total with SUM will be set to 0.
The rest of the aggregation methods seem to be OK.