# COMPARE TO

> Compare the report's period with an earlier one: the previous period, last year, or exact dates.

`COMPARE TO` runs the same report for a second period and shows both side by side.

```sql
FROM deals
SHOW won_value
TIMESERIES month
DURING this_year
COMPARE TO previous_year
```

## Syntax

```sql
COMPARE TO <target>
```

| Target | Compares with |
|---|---|
| `previous_period` | The same length of time just before |
| `previous_year` | The same dates a year earlier |
| `previous_year_match_day_of_week` | A year earlier, lined up by weekday |
| `previous_quarter`, `previous_month`, `previous_week`, `previous_day` | The period of that length just before |
| A range name, such as `last_year` | That range |
| `2025-01-01 UNTIL 2025-01-31` | Exact dates |

One comparison per query.

## What you see

- Charts draw both periods.
- Each table cell shows the comparison value with the change under it, green when it's good news.
- `WITH PERCENT_CHANGE` adds `percent_change_<metric>` columns (see [WITH](https://workstation.repzo.com/docs/analytics/repzoql/with)).
- In a [cohort report](https://workstation.repzo.com/docs/analytics/repzoql/cohort), `COMPARE TO previous_period` compares the totals (the All cohorts row and the headline).

## Related pages

- [SINCE, UNTIL, DURING](https://workstation.repzo.com/docs/analytics/repzoql/since-until-during)
- [WITH](https://workstation.repzo.com/docs/analytics/repzoql/with)
