series_max
This page explains how to use the series_max function in APL.
The series_max function compares two numeric arrays element by element and returns a new array. Each position in the result contains the maximum value between the corresponding elements from the two input arrays.
You use series_max when you want to create an envelope or upper bound from multiple series, combine baseline metrics with actual values, or merge data from different sources by keeping the higher value at each point. For example, you can compare response times across different servers and keep the higher value at each time point, or combine SLA thresholds with actual measurements.
Usage
Syntax
Parameters
| Parameter | Type | Description |
|---|---|---|
array1 | array | The first array of numeric values. |
array2 | array | The second array of numeric values. Must have the same length as array1. |
Returns
An array of numeric values. Each element is the maximum of the corresponding elements from array1 and array2.
Use case examples
You want to create an upper bound by comparing request durations across two different cities and keeping the higher value at each time point.
Query
Output
| london_avg | paris_avg | max_duration |
|---|---|---|
| [120, 150, 100] | [180, 130, 190] | [180, 150, 190] |
This query compares response times between two cities and creates a series containing the higher value at each time point.
You want to track the maximum count between successful and failed requests at each time point to identify the dominant request type.
Query
Output
| success_count | failure_count | max_count |
|---|---|---|
| [300, 280, 310] | [10, 290, 15] | [300, 290, 310] |
This query compares success and failure counts and returns the higher value at each time point, helping you understand the dominant traffic pattern.
List of related functions
- series_min: Compares two arrays and returns the minimum value at each position.
- series_less: Compares two arrays and returns
truewhere elements in the first array are less than the second. - series_greater: Compares two arrays and returns
truewhere the first array element is greater than the second. - max: Aggregation function that returns the maximum value across grouped records.