get_revenue_yoy โ€” Year-over-Year Revenue

Revenue per year with the year-over-year growth % and a YTD-vs-last-year comparison, from posted A/R invoices.

This is a Named SQL Query (SAP /SQLQueries) โ€” dynamic aggregate SQL returning per-query rows, not a fixed Service Layer entity.

Year-over-year revenue report โ€” how revenue changed from year to year. Returns one row per year (newest first) with the year’s revenue, the prior_year_revenue, the yoy_delta and yoy_growth_pct, plus a like-for-like year-to-date comparison: ytd_revenue (Jan 1 โ†’ the as-of date), prior_ytd_revenue (the same window one year earlier), and ytd_growth_pct. Revenue is taken from posted A/R invoices, aggregated across all customers into a single trend line.

Try these prompts

  • “how much did revenue grow year over year”
  • “revenue YTD vs last year”
  • “what was our revenue growth in 2025?”
  • “year-over-year revenue for C003”
  • “how has revenue trended since 2023”
  • “compare revenue by year”

ื ืกื• ื’ื ื‘ืขื‘ืจื™ืช

  • “ื›ืžื” ื’ื“ืœื• ื”ื”ื›ื ืกื•ืช ืžืฉื ื” ืœืฉื ื”?”
  • “ื”ืฉื•ื•ื” ื”ื›ื ืกื•ืช ืœืฉื ื” ืฉืขื‘ืจื””
  • “ืžื” ื”ื™ื” ืฉื™ืขื•ืจ ื”ืฆืžื™ื—ื” ื‘ื”ื›ื ืกื•ืช?”

Arguments

ArgRequiredMeaning
card_codeoptionalOne customer, e.g. C003. Omit for all customers.
as_of_dateoptionalThe YTD cut-off (YYYY-MM-DD) โ€” the year-to-date figure runs Jan 1 to here, compared against the same window last year. Omit for today.

Example result

Revenue is up on the year, but Q3 softened 2025. 2026 โ€” $48,000 so far, YTD +45% vs the same point in 2025 ($33,000). 2025 โ€” $61,500, +2.5% on 2024. 2024 โ€” $60,000, +29% on 2023’s $46,500.

Result columns

ColumnTypeMeaning
yearnumberThe calendar year. Declared number because that is what the row holds (int32 in the query); it is charted as an x-axis label, but the type states the DATA, not the axis role.
revenuenumberRevenue posted in that year, from posted A/R invoices.
prior_year_revenuenumberThe prior year’s revenue (0 for the earliest year).
yoy_deltanumberrevenue minus prior_year_revenue.
yoy_growth_pctnumberGrowth vs the prior year, percent.
ytd_revenuenumberRevenue from Jan 1 to the as-of date, this year.
prior_ytd_revenuenumberThe same Jan-1-to-as-of-date window, one year earlier.
ytd_growth_pctnumberGrowth of ytd_revenue vs prior_ytd_revenue, percent.

Charts

  • line: x=year, y=revenue, title=“Revenue over time”
  • bar: x=year, y=yoy_growth_pct, title=“YoY growth”
  • get_revenue_annual โ€” the plain per-year totals (with customer / salesperson breakdown).
  • get_revenue_quarterly / get_revenue_monthly โ€” finer breakdowns.