# Time in Learn

<figure><img src="/files/zwuJaUSGYo7mCOZjsG6Q" alt=""><figcaption></figcaption></figure>

To replicate the Time spent per month in all content types chart, you can use the following query:

```sql
SELECT
    date_trunc('month', occurred_at) as month,
    course_variant_id, 
    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,2
ORDER BY 1,2

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://enterprise-docs.datacamp.com/integrating-our-data-into-your-tools-via-data-connector-2.0/queries-to-recreate-key-reports-in-the-groups-tab/reporting-section/time-in-learn.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
