Forum

Posted by Amarendra, April 23, 2022, 7:11 p.m.

Question 121

Hey Leon, 

For Q121, the hint for WOW calculation reads  as the following

  • Definition of WoW change:  (number of today's first-ever bookings  - the same day of last week's first-ever bookings ) * 100.0 / today's first-ever bookings.

 

The code in the solution however is divided by the value of 7 days prior. 

(first_bookings -  LAG(first_bookings, 7) OVER(order by date))  * 100.0/ (LAG(first_bookings, 7) OVER(order by date)) AS wow_change

 

Is this correct? If yes, why are we taking the 7 days prior value as today's first-ever booking?

Answers

Hi Amarendra,

Thanks, yeah the WoW change, or MoM, YoY change's denominator should always be the old value. Just updated the formula.

Thanks,

Leon

SQLPad user avatar

Leon (949)

April 23, 2022, 7:18 p.m.