Service Level calc from Analytics API intervals

Pulling raw interval data from the queue observations query. I’ve got offered and answered counts per minute. Trying to figure out the exact math for Service Level (e.g., 80% in 20s). Should I sum the answered within target time and divide by total offered for the whole period? Or is there a specific field in the JSON payload I’m missing? The docs are vague on the aggregation logic.