A historian may hold millions of raw samples for a single tag, but a person asking a question rarely wants millions of numbers back. An aggregation function is the tool that collapses many samples into one representative value: the average pressure this hour, the maximum flow today, the count of readings received. Different aggregation functions answer genuinely different questions from the very same data, and knowing which to reach for is the difference between a query that informs and one that misleads. This is the umbrella concept that the more specialized aggregation techniques all sit beneath.
Aggregation Function in one line: An aggregation function collapses many time-series samples into a single summary value over a time window, such as their average, minimum, maximum, count, or sum. Time-series queries apply it after grouping samples into intervals, so each interval returns one number. Which function you choose determines which question the result answers.
The common aggregation functions form a small, well-defined family, and each reduces a set of samples to one number in a distinct way. Average returns the central tendency of the values in a window. Minimum and maximum return the extremes, the lowest and highest values seen. Count returns how many samples fell in the window, saying nothing about their values but everything about how many there were. Sum totals the values, which is meaningful when the samples represent additive quantities. First and last return the earliest and latest values in the window, useful when you care about state at a boundary rather than behavior across it.
These functions divide roughly by what aspect of the data they preserve. Average and sum are about the aggregate magnitude. Minimum and maximum are about the extremes and are the only simple functions that guarantee a spike survives the summarization. Count is about completeness and cardinality rather than value at all. First and last are about endpoints. A single window of samples can be summarized every one of these ways at once, and each summary is a legitimate but different view of the same underlying data.
It is worth separating the aggregation function from the grouping it runs over. Time-series queries almost always group samples into fixed intervals - each hour, each minute, each day - and then apply an aggregation function within each group so the query returns one row per interval. The grouping decides the resolution of the answer; the aggregation function decides what the answer means. The same buckets with average versus maximum produce two entirely different trend lines from identical raw data.
The right aggregation function follows directly from the question being asked, and mismatches are a common source of quietly wrong conclusions. If you want to know how a process typically behaved, average is usually the answer. If you want to know whether it ever crossed a limit, maximum or minimum is the only honest choice, because an average will hide a brief excursion inside a long calm window. Asking whether a pressure ever exceeded a threshold and then querying the average is a classic way to miss exactly the event you were checking for.
Some questions are about the data rather than the process. Count answers whether you actually received the readings you expected, which is a data-quality question that no value-based function can address; a window can have a perfectly reasonable average while quietly containing only a handful of samples. Sum answers questions about totals, and only makes sense when adding the samples is physically meaningful - totalizing produced volume, say - rather than adding up instantaneous pressures, where the sum has no useful meaning at all.
Beyond the basic family sit more specialized aggregations for cases the simple ones handle badly. A time-weighted average corrects for samples that are spaced unevenly in time, so a value that held for a long stretch counts more than one that flashed by. Percentiles answer questions about tail behavior that a plain average smooths away. Standard deviation answers questions about variability rather than level. These are all aggregation functions too; they exist because a real question sometimes needs a summary that average, min, max, count, and sum cannot express.
In a cloud SCADA platform, aggregation functions are what make years of high-resolution history usable. When Merobix draws a trend across a month, it does not ship a million raw points to the browser; it groups the data into intervals and applies an aggregation function per interval so the chart is both fast and meaningful. The choice of function is often exposed to the user, because the same tag over the same month is a different and equally valid picture depending on whether you asked for the average, the peak, or the count.
This is where choosing well pays off operationally. An engineer investigating a suspected over-pressure event should trend the maximum per interval so no spike is averaged out of existence. A manager summarizing typical throughput wants the average or the sum. A technician checking whether a remote site's collector stayed healthy overnight should look at the count per interval to confirm the expected number of readings arrived. Each of these people is querying the same historian and each needs a different aggregation function to get an answer they can trust.
Because aggregation runs at query time over the stored samples, it also lets one dataset serve many purposes without duplicating storage. The raw history is kept once, and averages, extremes, counts, and totals are all derived from it on demand. Understanding aggregation functions as a family - and knowing that the specialized ones like time-weighted average, percentiles, and standard deviation are members of that family for questions the basics cannot answer - is what lets a team pull the right summary for each decision instead of defaulting to an average that sometimes lies.
Average, minimum, maximum, count, and sum are the core family, joined by first and last for boundary values. Average gives central tendency, min and max give extremes, count gives how many samples arrived, sum totals additive quantities, and first and last give the endpoints of a window. Each reduces many samples to one number but preserves a different aspect of the data.
Start from the question. To know typical behavior, use average; to know whether a limit was ever crossed, use maximum or minimum; to check whether the expected readings arrived, use count; to total an additive quantity, use sum. Using an average to answer a limit-crossing question is a common mistake because the average hides brief excursions inside calm windows.
Yes. They belong to the same family but answer questions the basic functions handle poorly. A time-weighted average corrects for unevenly spaced samples, and percentiles describe tail behavior that a plain average smooths away. They exist precisely because average, min, max, count, and sum cannot express every summary a real question needs.
Merobix reads your field devices into a cloud SCADA - the real thing behind these terms, live in days from any browser.