Tabular OperatorsAggregate Operators
make-series
Creates series of aggregated values along a specified axis, typically time-based.
Syntax
make-series aggregation on column [from start] [to end] step interval [by group]Create time series
Parameters
| Name | Description |
|---|---|
| aggregation | Aggregation function to apply |
| column | Column defining the series axis (usually datetime) |
| start | Start of the axis range. When omitted, inferred from data min. (optional) |
| end | End of the axis range. When omitted, inferred from data max. (optional) |
| interval | Bin size for the axis |
| group | Grouping expression (optional) |
Examples
Example 1
datatable(ts:datetime, silver:long, region:string)[
datetime(2024-01-01), 100, "England",
datetime(2024-01-02), 250, "England",
datetime(2024-01-03), 180, "England",
datetime(2024-01-01), 50, "Francia",
datetime(2024-01-02), 300, "Francia",
datetime(2024-01-03), 120, "Francia"
]
| make-series total_loot = sum(silver) on ts
from datetime(2024-01-01) to datetime(2024-01-04) step 1d
by region| region (string) | ts (dynamic) | total_loot (dynamic) |
|---|---|---|
| England | [2024-01-01T00:00:00Z,2024-01-02T00:00:00Z,2024-01-03T00:00:00Z] | [100,250,180] |
| Francia | [2024-01-01T00:00:00Z,2024-01-02T00:00:00Z,2024-01-03T00:00:00Z] | [50,300,120] |
Example 2
datatable(ts:datetime, raids:long)[
datetime(2024-01-01), 3,
datetime(2024-01-02), 5,
datetime(2024-01-03), 2,
datetime(2024-01-04), 7
]
| make-series total = sum(raids) on ts step 1d| ts (dynamic) | total (dynamic) |
|---|---|
| [2024-01-01T00:00:00Z,2024-01-02T00:00:00Z,2024-01-03T00:00:00Z,2024-01-04T00:00:00Z] | [3,5,2,7] |