﻿---
title: ES|QL DELTA function
description: 
url: https://www.elastic.co/elastic/docs-builder/docs/2980/reference/query-languages/esql/functions-operators/time-series-aggregation-functions/delta
products:
  - Elasticsearch
---

# ES|QL DELTA function
<applies-to>
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Preview since 9.2
</applies-to>


## Syntax

![Embedded](https://www.elastic.co/elastic/docs-builder/docs/2980/reference/query-languages/esql/images/functions/delta.svg)


## Parameters

<definitions>
  <definition term="field">
    the metric field to calculate the value for
  </definition>
  <definition term="window">
    the time window over which to compute the delta over time
  </definition>
</definitions>


## Description

Calculates the absolute change of a gauge field in a time window.

## Supported types


| field   | window                                                                  | result |
|---------|-------------------------------------------------------------------------|--------|
| double  | time_duration <applies-to>Elastic Stack: Preview since 9.3</applies-to> | double |
| integer | time_duration <applies-to>Elastic Stack: Preview since 9.3</applies-to> | double |
| long    | time_duration <applies-to>Elastic Stack: Preview since 9.3</applies-to> | double |


## Example

```esql
TS k8s
| WHERE pod == "one"
| STATS tx = SUM(DELTA(network.bytes_in)) BY cluster, time_bucket = TBUCKET(10minute)
```


| tx:double | cluster:keyword | time_bucket:datetime     |
|-----------|-----------------|--------------------------|
| -351.0    | prod            | 2024-05-10T00:00:00.000Z |
| 552.0     | qa              | 2024-05-10T00:00:00.000Z |
| 127.0     | staging         | 2024-05-10T00:00:00.000Z |
| 280.0     | prod            | 2024-05-10T00:10:00.000Z |