Write a query to find the top three highest-billing insurance providers for a specific diagnostic test over the last quarter at Natera.
Use the Panorama test and the previous calendar quarter relative to the query date. Exclude voided claims and records outside the quarter.
Output
- One row per selected insurance provider with
provider_id, provider_name, total_billed, and billing_rank.
- Return exactly the three highest-billing providers, ordered by
billing_rank, then provider_name.
Output details
- Treat
DATE '2026-07-01' as today's date.
- Use an inclusive quarter start and an exclusive quarter end.
- Rank ties by
provider_name ascending after total_billed descending.
- Place NULL
total_billed values after non-NULL values when ranking.
- Exclude claims whose
claim_status is NULL, as well as claims with status VOID.
- Return
total_billed as the unrounded sum, preserving its numeric precision.