Hey there,

Often you come across a dataset with periodic and seasonal patterns. The example we consider for our latest recipe is Amazon's e-commerce revenue from 2001 to 2008. Retail and e-commerce revenue is highly seasonal with most of their revenue in the last four months of the year, especially around Black Friday and Xmas.

A regular moving average isn't appropriate for a seasonal data set. We need to get more sophisticated, with weights for each of the periods we are averaging.

In this recipe, we show step-by-step how to use SQL window functions, self-joins and CASE statements to compute a moving average with weights, giving more importance to the most recent quarter:

Calculating Weighted Moving Averages to Smooth Data

Enjoy!

best,
Ganesh

PS: I'm always looking for new data analysis topics to write about. What would you like to see? Just hit reply and let me know. I personally reply to all emails.
 
Copyright © 2017 Silota Inc., All rights reserved.


Want to change how you receive these emails?
You can update your preferences or unsubscribe from this list

Email Marketing Powered by Mailchimp