To replicate the Time spent per month in all content types chart, you can use the following query:
SELECT
date_trunc('month', occurred_at) as month,
if(sum(duration_engaged) = 0, 0, sum(duration_engaged) / 3600) AS total_hours_on_learn
FROM data_connector_1234.fact_learn_events
-- The chart includes the current month and 11 months before
WHERE date(occurred_at) between
date_trunc('month', date_add('month', -11, current_date)) and current_date
GROUP BY 1
ORDER BY 1