Description 
Transforms each sample in the time series to the difference between the sample and the previous one. Samples with a negative value difference are either set to null or set to: (maxValue + Difference + 1) if maxValue is specified. 

Input 
Time Series – multiple (Single or multiple time series.) 

Parameters 
Max Value 
Optional, numeric, default=null (Time series maximum value) 

Keep Last Value Limit 
Optional, numeric, default=null (Limit of null values to skip) 
Output 
Transformed Time Series  multiple 

Available in 
Alerts + Composite + Dashboards 
USAGE EXAMPLE
The NonNegativeDelta function is useful when you have a counter metric, whose value increases monotonically and occasionally resets to zero (on restart). By applying this function, you can monitor the difference between two successive samples. When the counter resets, or in any case the result is a negative value, the function will return a null value.
In Anodot, for example, we track the number of triggered alerts for each account using a counter metric. By using the NonNegativeDelta function, we can monitor anomalies in the rate of triggered alerts, which could imply possible issues in our detection algorithms.
Here’s how the counter metric (which count triggered alerts) looks like:
After applying the NonNegativeDelta function, we can uncover the rate pattern of triggered alerts, and an adequate baseline can be fitted to monitor anomalies: