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

bookChallenge: Calculate Percentage Growth

Tâche

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

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 2. Chapitre 6
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

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

Glissez pour afficher le menu

Tâche

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 desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 2. Chapitre 6
single

single

some-alt