AR aging
Open customer invoices, bucketed by age as of today.
- Grain
- one row per customer invoice with an amount due
- Built from
- 2Raw tables
- 2Staging
- 1Core
- 1Analytics
- Reads from Workday Financial Management
- companycustomer_invoice
- Ships as
- Weld and dbt SQL, open source on GitHub
1-- core.workday_financial_management.ar_aging
2-- Open customer invoices, bucketed by age as of today.
3--
4-- Grain: one row per customer invoice with an amount due.
5--
6-- This is the current state: Workday's amount due as of the last sync. It cannot
7-- be rebuilt for a past date from these tables.
8--
9-- Age basis: Workday does not return the computed due date on this operation. An
10-- invoice with a due date override is aged from that date (days past due); every
11-- other invoice is aged from its invoice date (days outstanding). aging_basis says
12-- which, and the two should not be read as the same measure. To age by due date
13-- throughout, join your payment terms and add the term days to invoice_date.
14--
15-- Currency: amount_due is in the invoice currency (currency). Sum per currency.
16--
17-- Cancelled invoices are left out. There is no payables aging: the supplier
18-- invoice operation does not return an open amount.
19
20WITH open_invoices AS (
21 SELECT
22 i.*,
23 c.company_name,
24 c.company_currency
25 FROM {{staging.workday_financial_management.customer_invoice}} i
26 LEFT JOIN {{staging.workday_financial_management.company}} c
27 ON c.workday_tenant = i.workday_tenant
28 AND c.company_id = i.company_id
29 WHERE i.amount_due != 0
30 AND LOWER(COALESCE(i.document_status, '')) NOT LIKE '%cancel%'
31),
32
33aged AS (
34 SELECT
35 *,
36 CURRENT_DATE() AS as_of_date,
37 IF(due_date_override IS NOT NULL, 'due date', 'invoice date') AS aging_basis,
38 DATE_DIFF(CURRENT_DATE(), COALESCE(due_date_override, invoice_date), DAY) AS days_aged
39 FROM open_invoices
40)This model and the 3 it depends on. Deploy them together; refs like {{staging.…}} resolve to the matching folders in Weld, and the dbt view uses source() and ref().
How it counts. And where it stops.
This is the current state: Workday's amount due as of the last sync. It cannot be rebuilt for a past date from these tables. Age basis: Workday does not return the computed due date on this operation. An invoice with a due date override is aged from that date (days past due); every other invoice is aged from its invoice date (days outstanding). aging_basis says which, and the two should not be read as the same measure. To age by due date throughout, join your payment terms and add the term days to invoice_date. Currency: amount_due is in the invoice currency (currency). Sum per currency. Cancelled invoices are left out. There is no payables aging: the supplier invoice operation does not return an open amount.
Raw tables it reads
- raw.workday_financial_management.company
- raw.workday_financial_management.customer_invoice
More Workday Financial Management models
Put Workday Financial Management in front
of your agents.
Connect Workday Financial Management, deploy the models, and ask questions in Claude, Cursor or ChatGPT. Free for 14 days, no credit card.