> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tracecat.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Case durations

> Measure elapsed time between case events, such as time to triage or time to resolution, and read the results from workflows.

<Badge icon="lock" color="blue" size="lg" shape="pill">Enterprise Edition</Badge>

Durations measure the time between two case events, such as `Time to triage` from case creation until the status changes to `In progress`.
Tracecat calculates every duration on every case and shows it in the case header.

<img src="https://mintcdn.com/tracecat/O3EeW3V5Iek0f9qX/img/cases/case-fields-panel.png?fit=max&auto=format&n=O3EeW3V5Iek0f9qX&q=85&s=687979d0b4790f01b2e50671b3882147" alt="Durations on a case" width="1207" height="660" data-path="img/cases/case-fields-panel.png" />

## Create a duration

1. Go to `Cases` and open the durations view from the header toolbar.
2. Select `Add duration`.
3. Enter a name and an optional description.
4. Configure the `From event` that starts the clock and the `To event` that stops it.

<img src="https://mintcdn.com/tracecat/9IEnC4OWdnuB3EvN/img/cases/case-duration.png?fit=max&auto=format&n=9IEnC4OWdnuB3EvN&q=85&s=704a521ba7a0d05812ac53df88bda576" alt="Create a duration" width="3440" height="1848" data-path="img/cases/case-duration.png" />

The durations view lists each duration with its start and end events.

<img src="https://mintcdn.com/tracecat/O3EeW3V5Iek0f9qX/img/cases/durations-list.png?fit=max&auto=format&n=O3EeW3V5Iek0f9qX&q=85&s=79e765ec5f1dff4c1d066556aa3a1021" alt="Durations list" width="1207" height="350" data-path="img/cases/durations-list.png" />

## Configure events

Each event has an event type, optional filters, and an occurrence.

| Event type | Filter |
| - | - |
| `Case created`, `Case updated`, `Case closed`, `Case reopened`, `Case viewed` | None |
| `Priority changed`, `Severity changed`, `Status changed` | New value, such as status `In progress` |
| `Assignee changed` | None |
| `Tag added`, `Tag removed` | Tag |
| `Custom field changed` | Custom field |
| `Dropdown value changed` | Dropdown and option, such as `Escalation tier` → `Tier 2` |
| `Comment added`, `Comment deleted`, `Comment reply added`, `Comment reply deleted` | None |

Occurrence picks which matching event anchors the duration:

* `First seen` uses the earliest matching event. Use it for first-response metrics such as time to triage.
* `Last seen` uses the most recent matching event. Use it when an event can repeat, such as time from the last reopen to close.

A duration starts once its `From event` happens and finishes once its `To event` happens.
Until then, the case header shows the time elapsed so far.

## Example durations

| Duration | From | To |
| - | - | - |
| Time to triage | `Case created`, first seen | `Status changed` to `In progress`, first seen |
| Time to assign | `Case created`, first seen | `Assignee changed`, first seen |
| Time to escalate | `Case created`, first seen | `Dropdown value changed` to `Tier 2`, first seen |
| Time to resolve | `Case created`, first seen | `Case closed`, last seen |

## Read durations from workflows

Use `core.cases.get_case_metrics` to read durations for one or more cases as time-series data for reporting.

```yaml theme={null}
- ref: case_metrics
  action: core.cases.get_case_metrics
  args:
    case_ids:
      - ${{ TRIGGER.case_id }}
```

## Related pages

* See [Dropdowns](/automations/cases/dropdowns) to create the classifications you measure with `Dropdown value changed`.
* See [Cases](/automations/core-actions/case-actions/cases) for the `get_case_metrics` output format.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.