Trying to calculate Service Level percentage using the raw interval data from the Genesys Cloud Analytics API. The endpoint is GET /api/v2/analytics/queues/summary. I pull the data for a 24-hour window with a 15-minute interval. The response gives me answeredCount, abandonedCount, and handledCount. It also provides serviceLevel as a boolean in each interval.
The problem is aggregating this correctly. If I just sum the answeredCount where serviceLevel is true and divide by the total answeredCount, the number feels off compared to the UI. I suspect I need to weight by the interval duration or handle partial intervals differently. Here is the snippet I am using in C# to process the response:
csharp
var totalAnswered = intervals.Sum(i => i.answeredCount);
var answeredInSL = intervals.Sum(i => i.serviceLevel ? i.answeredCount : 0);
var slPercent = totalAnswered > 0 ? (answeredInSL / (double)totalAnswered) * 100 : 0;
The UI shows 82% but my code calculates 78%. Is the API returning truncated counts? Or am I missing a field like waitTime to calculate the actual time in queue? I checked the docs but they do not explain the weighting logic for interval aggregation. The timezone is US/Pacific so daylight saving might be shifting the intervals too. Any ideas on the correct formula?