I have data on monthly sales like this
Company Month Sales
Adidas 2018-09 100
Adidas 2018-08 95
Adidas 2018-07 120
Adidas 2018-06 155
...and so on
I need to add another column stating the median over the past 12 months
(or as many as there is data for if 12 months are not available).
In Python I figured out how to do it with for
loops, but I'm not sure how to do in BigQuery.
Thank you!
Here is an approach that might work:
The results are: