SELECT DISTINCT DATE_TRUNC('month', event_time)::date AS mnth , COUNT(event_id) OVER(PARTITION BY DATE_TRUNC('month', event_time)::date ORDER BY DATE_TRUNC('month', event_time)::date) AS count_month , COUNT(event_id) OVER(ORDER BY DATE_TRUNC('month', event_time)::date) AS count_month_cum FROM tools_shop.events e JOIN tools_shop.users u ON e.user_id = u.user_id JOIN tools_shop.orders o ON u.user_id = o.user_id WHERE event_name = 'view_item'