weekly moving average from current_date to the last 52 weeks
SELECT g(f(date)) AS 'week of',
       AVG(...) AS 'moving average'
    FROM tbl
    WHERE date &gt; CURDATE() - INTERVAL 52 WEEK
    GROUP BY f(date)


Where f() is a function that turns a date (or datetime or timestamp) into a number.  Something like FLOOR((TO_DAYS(date) - 3) / 7), where the 3 is chosen based on what day a week "starts" on.  (I doubt if '3' is correct.)  g() is the inverse:  FROM_DAYS((x * 7) + 3).  Test:

mysql&gt; SELECT                            NOW(), 
                          FLOOR((TO_DAYS(now()) - 3) / 7) AS 'f(now)',
              FROM_DAYS( (FLOOR((TO_DAYS(now()) - 3) / 7) * 7) + 3) AS 'g(f(now))';
+---------------------+--------+------------+
| NOW()               | f(now) | g(f(now))  |
+---------------------+--------+------------+
| 2016-05-24 17:13:54 | 105210 | 2016-05-24 |
+---------------------+--------+------------+