Days sales outstanding
Overview
The Days Sales Outstanding (DSO) chart in the Invoices tab of the Billing and Collections dashboard. It measures the average number of days it takes to collect revenue after an invoice is issued. It provides a leading indicator of cash flow efficiency.
Chart configuration
This chart is built using Metabase’s Visual Builder and uses the following settings:
-
Grouping:
Created At: Month
-
Summarize By:
Sum of Invoice Total
Sum of Amount Due
Average of Trend
Trend Formula
The Trend is calculated for each invoice as:
Trend = ((invoice_total - amount_due) / invoice_total) * 30
This approximates the portion of the invoice collected to date, scaled to a 30-day collection cycle.
Sample chart output
Created At (Month) | Sum of Invoice Total | Sum of Amount Due | Average of Trend |
---|---|---|---|
February 2025 | 593,893.25 | 447,432.12 | 12.41 |
- Sum of Invoice Total: Total invoiced amount for all invoices created in February 2025.
- Sum of Amount Due: Remaining unpaid amount as of query time.
- Average of Trend: Average time-to-collection estimate across all invoices in that month.
SQL behind the chart
The SQL below is auto-generated by Metabase and reflects the configuration above:
SELECT
toStartOfMonth(source.created_at) AS created_at,
SUM(source.invoice_total) AS sum,
SUM(source.amount_due) AS sum_2,
AVG(source.Trend) AS avg
FROM
(
SELECT
invoices.status AS status,
invoices.invoice_total AS invoice_total,
invoices.amount_due AS amount_due,
invoices.created_at AS created_at,
(
toFloat64(invoice_total - amount_due) / NULLIF(toFloat64(invoice_total), 0.0)
) * 30 AS Trend
FROM
invoices
WHERE
status IN ('approved', 'paid', 'partially_paid')
) AS source
GROUP BY
toStartOfMonth(source.created_at)
ORDER BY
toStartOfMonth(source.created_at) ASC
Additional notes
- Metric Interpretation: A lower average Trend implies slower collections; a higher value means faster payment realization.
- Data Source:
invoices
table - Filter: Only invoices with
status
in('approved', 'paid', 'partially_paid')
are included. - Time Dimension:
created_at
is bucketed monthly usingtoStartOfMonth
.
Updated 7 days ago