Group by week:
select COUNT(id) as total_count, WEEKOFYEAR(created_at) AS yr_week from analytics where
is_redeemed
= 1 and created_at
>= NOW() - INTERVAL 7 WEEK group by yr_week
Group by month:
select COUNT(id) as total_count, MONTH(created_at) AS yr_week from analytics where
is_redeemed
= 1 and created_at
>= NOW() - INTERVAL 3 MONTH group by yr_week