Skip to main content
All Problems
hard0% acceptance

7-Day Moving Average of Daily Billing

Compute a 7-day trailing moving average of total daily billing. First aggregate billing by billed_at date, then compute the moving average over the preceding 6 rows and the current row.

Schema

🔑idINT
🔗visit_idINT
amountREAL
insurance_coveredREAL
patient_responsibilityREAL
statusTEXT
billed_atTEXT
paid_atTEXTNULL
postgresql

Run your query to see results

Press Ctrl + Enter to execute