I am currently trying to calculate the percentages of different statuses based on 3 count values. Let's assume I have 3 statuses: 1) Passed 2) Failed 3) Skipped
When dealing with only two cases, I was able to use a combination of the Floor and Ceil methods to ensure that the total always added up to 100%. However, now that I have 3 values, I am facing difficulty. Any assistance would be greatly appreciated.
const successRate = Math.floor((this.progressCounts.getStatusCount('Passed') * 100) / this.progressCounts.getTotal()),
failureRate = Math.ceil((this.progressCounts.getStatusCount('Failed') * 100) / this.progressCounts.getTotal()),
skippedRate = Math.floor((this.progressCounts.getStatusCount('Skipped') * 100) / this.progressCounts.getTotal());