Find Year-on-Year Growth Rate

This is a common interview question that you MUST nail!

The formula is (value - last_year_value) / last_year_value. You can calculate last_year_value as
πŸ“Œ 𝙻𝙰𝙢(πšŸπšŠπš•πšžπšŽ, 𝟷) πš˜πšŸπšŽπš› (πš˜πš›πšπšŽπš› πš‹πš’ πšŸπšŠπš•πšžπšŽ)

𝙻𝙰𝙢(πšŸπšŠπš•πšžπšŽ,𝟷) gets the value from the previous row. 𝙻𝙰𝙢(πšŸπšŠπš•πšžπšŽ,𝟸) gets the value from the row before the previous row.

STEPS:
1️⃣ Use 𝙻𝙰𝙢 to get last year's revenue. Then, find difference between this year and last year's revenue.
2️⃣ π™²π™°πš‚πšƒ all INT to FLOAT. Calculate the growth rate by dividing the difference by last year's revenue.

Caution! Casting integer to float is important for growth rates of integer columns. Otherwise, integer division will occur (instead of float division).

What's the difference? Integer division 1/2=0, while float division 1/2=0.5.

πŸ‘‡ Full example below.