Calculating Service Level % from Analytics API interval data

Pulling interval data from /api/v2/analytics/queues/summary for a specific queue. The response gives me offerCount and answerCount, but nothing explicit for Service Level percentage. I need to calculate it manually using the intervals where offerCount > 0.

Here’s the aggregation logic I’m trying to implement in my Node.js service:

let totalOffers = 0;
let answeredWithinSLA = 0;

intervals.forEach(interval => {
 if (interval.offerCount > 0) {
 totalOffers += interval.offerCount;
 // Assuming slaThreshold is 20 seconds
 if (interval.answerTime <= 20) {
 answeredWithinSLA += interval.answerCount;
 }
 }
});

const serviceLevel = (answeredWithinSLA / totalOffers) * 100;

The issue is answerTime isn’t always accurate or present in every interval bucket, especially if the call abandons immediately. The waitTime field seems more reliable for SLA calculation. Is there a standard way to derive the SLA % from these raw intervals? Or am I missing a specific metric in the response payload that does this calculation for me? The docs mention serviceLevel in some reports but not in this specific interval endpoint.

You’re missing the serviceLevel metric in your request body. The endpoint doesn’t return it by default unless you explicitly ask for it in the metrics array. Also, answerCount alone isn’t enough for SL calculations. You need to filter by the service level threshold (usually 20s).

The docs state: “The serviceLevel metric represents the percentage of offers answered within the service level threshold.” But you have to request it.

In .NET SDK, it looks like this:

var request = new QueuesSummaryRequest
{
 DateFrom = "2023-10-01T00:00:00.000Z",
 DateTo = "2023-10-01T23:59:59.000Z",
 GroupBy = "interval",
 Metrics = new List<string> { "offerCount", "answerCount", "serviceLevel", "serviceLevelAnswerCount" }
};

var response = await _client.AnalyticsApi.PostAnalyticsQueuesSummaryAsync("queueId", request);

If you really need to calculate it manually from intervals, you can’t just sum answerCount. You need serviceLevelAnswerCount. That’s the count of answers within the threshold.

So the formula is:
SL% = (Sum of serviceLevelAnswerCount / Sum of offerCount) * 100

Wait, actually offerCount in the interval response is usually the total offers in that bucket. Make sure you’re not double counting. The interval data aggregates. If you poll every 5 minutes, the offerCount is for that 5 min slice.

I ran into this exact issue with Azure Functions polling. The serviceLevel metric in the response object is pre-calculated by Genesys. It’s accurate. Don’t try to reinvent the wheel with raw counts unless you have a very specific custom SL threshold that differs from the queue config.

Check your request payload. If you don’t see serviceLevelAnswerCount in the response, you’re not asking for it right. The API is strict about metrics.