# TIMESERIES

> Split the numbers by day, week, month, quarter, or year, with every period listed.

`TIMESERIES` splits the numbers by time and lists every period, with zeros where nothing happened. It's the clause for trend lines.

```sql
FROM orders
SHOW total
TIMESERIES month
DURING last_12_months
```

## Syntax

```sql
TIMESERIES day | week | month | quarter | year | day_of_week | hour_of_day
```

## Default period

Without `SINCE` or `DURING`, `TIMESERIES` picks a window for its unit:

| Unit | Window |
|---|---|
| `day` | The last 30 days |
| `week` | The last four weeks |
| `month` | The last three months |
| `quarter` | The last four quarters |
| `year` | The last three years |

## With GROUP BY

`TIMESERIES` can be combined with a grouping. Time comes first, then the field:

```sql
FROM deals
SHOW won_value
TIMESERIES month
GROUP BY owner
DURING this_year
ON won_at
```

`GROUP BY month` also groups by month, but lists only the months that have data. Use it for tables; use `TIMESERIES` for charts over time.

## Running totals

Add `WITH CUMULATIVE_VALUES` to add each period to the ones before it. See [WITH](https://workstation.repzo.com/docs/analytics/repzoql/with).

## Related pages

- [GROUP BY](https://workstation.repzo.com/docs/analytics/repzoql/group-by)
- [SINCE, UNTIL, DURING](https://workstation.repzo.com/docs/analytics/repzoql/since-until-during)
- [COMPARE TO](https://workstation.repzo.com/docs/analytics/repzoql/compare-to)
