What is days sales outstanding (DSO)?
Definition
Days sales outstanding estimates how many days of credit sales remain tied up in accounts receivable. It is useful as a trend and segment comparison, but seasonality and revenue mix can distort a single-period value.
What data do you need?
- Beginning and ending AR, or daily AR snapshots
- Credit sales for the same period and scope
- Fiscal calendar and day count
- Entity, customer segment, and currency dimensions
- Consistent treatment of taxes, credits, and intercompany revenue
SQL pattern
WITH ar AS (
SELECT
date_trunc('month', as_of_date) AS month,
AVG(total_open_ar) AS average_ar
FROM daily_ar_balance
GROUP BY 1
), sales AS (
SELECT
date_trunc('month', invoice_date) AS month,
SUM(credit_sales_amount) AS credit_sales
FROM modeled_invoices
GROUP BY 1
)
SELECT
ar.month,
ar.average_ar / NULLIF(sales.credit_sales, 0)
* EXTRACT(day FROM (ar.month + INTERVAL '1 month - 1 day')) AS dso
FROM ar
JOIN sales USING (month)
ORDER BY ar.month;Common pitfalls
Where does this metric apply?
This metric commonly uses data from NetSuite, Xero, FreshBooks, QuickBooks, SAP, plus any reconciled warehouse or ledger models that provide the same business grain.