Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Challenge: Year-over-Year Revenue Comparison | Period-over-Period Comparisons
SQL for Finance and Accounting

bookChallenge: Year-over-Year Revenue Comparison

Tehtävä

Swipe to start coding

Your task is to calculate the year-over-year (YoY) revenue growth percentage for each month using the revenue table.

  • Group the revenue data by year and month.
  • Use a window function such as LAG() to get the previous year's revenue for the same month.
  • Calculate the YoY growth percentage using the formula: (current_year_revenue - last_year_revenue) / last_year_revenue * 100.
  • Your query should return the following columns:
    • year: the year of the revenue period.
    • month: the month of the revenue period.
    • total_revenue: total revenue for that year and month.
    • last_year_revenue: total revenue for the same month in the previous year.
    • yoy_growth_percent: the YoY growth percentage, as a numeric value (can be decimal).
  • Only include rows where last_year_revenue is not null (i.e., exclude the first year for each month).

Ratkaisu

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 4
single

single

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

close

bookChallenge: Year-over-Year Revenue Comparison

Pyyhkäise näyttääksesi valikon

Tehtävä

Swipe to start coding

Your task is to calculate the year-over-year (YoY) revenue growth percentage for each month using the revenue table.

  • Group the revenue data by year and month.
  • Use a window function such as LAG() to get the previous year's revenue for the same month.
  • Calculate the YoY growth percentage using the formula: (current_year_revenue - last_year_revenue) / last_year_revenue * 100.
  • Your query should return the following columns:
    • year: the year of the revenue period.
    • month: the month of the revenue period.
    • total_revenue: total revenue for that year and month.
    • last_year_revenue: total revenue for the same month in the previous year.
    • yoy_growth_percent: the YoY growth percentage, as a numeric value (can be decimal).
  • Only include rows where last_year_revenue is not null (i.e., exclude the first year for each month).

Ratkaisu

Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 4
single

single

some-alt