---
title: counter_zero_time() | Tiger Data Docs
description: Calculate the time when the counter value is predicted to have been zero
---

Since [1.3.0](https://github.com/timescale/timescaledb-toolkit/releases/tag/1.3.0)

Calculate the time when the counter value is predicted to have been zero. This is the x-intercept of the linear fit between counter value and time.

## Samples

Estimate the time when the counter started

```
SELECT
    id,
    bucket,
    counter_zero_time(summary)
FROM (
    SELECT
        id,
        time_bucket('15 min'::interval, ts) AS bucket,
        counter_agg(ts, val) AS summary
    FROM foo
    GROUP BY id, time_bucket('15 min'::interval, ts)
) t
```

## Arguments

The syntax is:

```
counter_zero_time(
    summary CounterSummary
) RETURNS TIMESTAMPTZ
```

| Name      | Type             | Default | Required | Description                                                                                                                     |
| --------- | ---------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `summary` | `CounterSummary` | -       | ✔        | A counter aggregate created using [`counter_agg`](/docs/reference/toolkit/counters-and-gauges/counter_agg/counter_agg/index.md) |

## Returns

| Column              | Type        | Description                                                    |
| ------------------- | ----------- | -------------------------------------------------------------- |
| counter\_zero\_time | TIMESTAMPTZ | The time when the counter value is predicted to have been zero |
