# 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.