series_subtract()

Calculates the element-wise subtraction of two numeric series inputs.

Syntax

series_subtract(series1, series2)

Learn more about syntax conventions.

Parameters

Name Type Required Description
series1, series2 dynamic ✔️ Arrays of numeric values, the second array to be element-wise subtracted from the first array.

Returns

A dynamic array of calculated element-wise subtract operation between the two inputs. Any non-numeric element or non-existing element, such as in the case of arrays of different sizes, yields a null element value.

Example

range x from 1 to 3 step 1
| extend y = x * 2
| extend z = y * 2
| project s1 = pack_array(x,y,z), s2 = pack_array(z, y, x)
| extend s1_subtract_s2 = series_subtract(s1, s2)

Output

s1 s2 s1_subtract_s2
[1,2,4] [4,2,1] [-3,0,3]
[2,4,8] [8,4,2] [-6,0,6]
[3,6,12] [12,6,3] [-9,0,9]