How do you handle missing or inconsistent data when preparing a report for finance teams?
Using the invoices, customers, and exchange_rates tables, write a SQL query that produces a monthly data-quality reconciliation for January through March 2025.
Output
- One row per calendar month, ordered chronologically.
- Columns:
report_month, invoice_count, accepted_invoice_count, missing_customer_count, missing_rate_count, invalid_amount_count, invalid_status_count, and accepted_amount_usd.
- Exclude invoices outside the date range. Treat positive amounts and statuses normalized to
posted or paid as valid. Include only invoices with a matching customer, exchange rate, valid amount, and valid status in accepted counts and USD totals.