Skip to main content
Skip to main content

deltaSum

Sums the arithmetic difference between consecutive rows. If the difference is negative, it is ignored.

note

The underlying data must be sorted for this function to work properly. If you would like to use this function in a materialized view, you most likely want to use the deltaSumTimestamp method instead.

Syntax

Arguments

Returned value

  • A gained arithmetic difference of the Integer or Float type.

Examples

Query:

Result:

Query:

Result:

Query:

Result:

See Also

Try ClickHouse Cloud for FREE

Separation of storage and compute, automatic scaling, built-in SQL console, and lots more. $300 in free credits when signing up.

Try it for Free