Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Calculate Percentage Growth | Period-over-Period Comparisons
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
SQL for Finance and Accounting

bookChallenge: Calculate Percentage Growth

Task

Swipe to start coding

Write a SQL query to calculate the percentage growth in revenue for each month compared to the previous month.

  • Group the revenue table by month and sum the amount for each month.
  • Use a window function to access the previous month's total revenue for each row.
  • Calculate the percentage growth as the difference between the current and previous month's revenue divided by the previous month's revenue, multiplied by 100.
  • Handle cases where the previous month's revenue is NULL or zero by returning NULL for the percentage growth.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 2. ChapterΒ 6
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Suggested prompts:

Can you explain this in simpler terms?

What are the main points I should remember?

Can you give me an example?

close

bookChallenge: Calculate Percentage Growth

Swipe to show menu

Task

Swipe to start coding

Write a SQL query to calculate the percentage growth in revenue for each month compared to the previous month.

  • Group the revenue table by month and sum the amount for each month.
  • Use a window function to access the previous month's total revenue for each row.
  • Calculate the percentage growth as the difference between the current and previous month's revenue divided by the previous month's revenue, multiplied by 100.
  • Handle cases where the previous month's revenue is NULL or zero by returning NULL for the percentage growth.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 2. ChapterΒ 6
single

single

some-alt