Global Aggregate Functions
Functions for aggregating values across all events in the entire dataset.
Understanding Global Aggregates
While case aggregates operate within a single case, global aggregates calculate across all events in the dataset. This enables:
- Calculating overall totals and averages
- Comparing individual events or cases to global benchmarks
- Computing percentages of total
Common Patterns
-
Overall Statistics:
allSum(Revenue) // Total revenue
allAvg(ProcessingTime) // Average processing time
allCount() // Total number of events
-
Percentage of Total:
caseSum(Amount) / allSum(Amount) * 100 // This case as % of total
Amount / allSum(Amount) * 100 // This event as % of total
-
Compare to Average:
Duration - allAvg(Duration) // Difference from average
Duration / allAvg(Duration) // Ratio to average
-
Filtered Global Aggregates: Calculate aggregates for a subset of the data:
allSumIf(Amount, Region == "Europe") // European total
allAvgIf(Duration, Priority == "High") // High-priority average
allCountIf(Status == "Completed") // Completed count
-
Identify Outliers:
if(Duration > allAvg(Duration) + 2 * allStdDev(Duration),
"Outlier", "Normal")
allSum
(attribute) Sums a numeric attribute across all events in the dataset.
| Parameters | | attribute | number | The attribute to sum | |
| Returns | number |
| Examples | allSum(Revenue) → Total revenue across all cases |
allAvg
(attribute) Calculates the average across all events in the dataset.
| Parameters | | attribute | number | The attribute to average | |
| Returns | number |
| Examples | allAvg(ProcessingTime) → Average processing time overall |
allMin
(attribute) Returns the minimum value across all events in the dataset.
| Parameters | | attribute | number | The attribute whose minimum you want | |
| Returns | number |
| Examples | allMin(StartTime) → Earliest timestamp in the data |
allMax
(attribute) Returns the maximum value across all events in the dataset.
| Parameters | | attribute | number | The attribute whose maximum you want | |
| Returns | number |
| Examples | allMax(Amount) → Highest amount in the data |
allCount
() Returns the total number of events in the dataset.
| Returns | number |
| Examples | allCount() → Total event count |
allMedian
(attribute) Returns the median value across all events in the dataset.
| Parameters | | attribute | number | The attribute whose median you want | |
| Returns | number |
| Examples | allMedian(Duration) → Middle value of all durations |
allStdDev
(attribute) Calculates the standard deviation across all events in the dataset.
| Parameters | | attribute | number | The attribute to analyze | |
| Returns | number |
| Examples | allStdDev(ProcessingTime) → Standard deviation of processing times |
allCountDistinct
(expr) Counts distinct values across all events in the dataset.
| Parameters | | expr | any | Value expression | |
| Returns | number |
| Examples | allCountDistinct(Resource) → Number of unique resources |
allSumIf
(attribute, condition) Sums values across all events that match a condition.
| Parameters | | attribute | number | The attribute to sum | | condition | boolean | The condition to filter by | |
| Returns | number |
| Examples | allSumIf(Amount, Region == "Europe") → Total amount for European cases |
allAvgIf
(attribute, condition) Averages values across all events that match a condition.
| Parameters | | attribute | number | The attribute to average | | condition | boolean | The condition to filter by | |
| Returns | number |
| Examples | allAvgIf(Duration, Priority == "High") → Average duration for high priority items |
allCountIf
(condition) Counts all events that match a condition.
| Parameters | | condition | boolean | The condition to count | |
| Returns | number |
| Examples | allCountIf(Status == "Completed") → Number of completed events |
allMinIf
(attribute, condition) Returns the minimum value across all events that match a condition.
| Parameters | | attribute | number | The attribute whose minimum you want | | condition | boolean | The condition to filter by | |
| Returns | number |
| Examples | allMinIf(Price, Category == "Premium") → Lowest premium price |
allMaxIf
(attribute, condition) Returns the maximum value across all events that match a condition.
| Parameters | | attribute | number | The attribute whose maximum you want | | condition | boolean | The condition to filter by | |
| Returns | number |
| Examples | allMaxIf(Duration, Activity == "Approval") → Longest approval duration |
Statistical Functions
Statistical functions for analyzing the distribution of values across all events.
-
Identify Performance Tiers:
Percentiles are passed as fractions from 0 to 1 (0.25 = 25th percentile):
if(Duration < allPercentile(Duration, 0.25), "Fast",
if(Duration < allPercentile(Duration, 0.75), "Normal", "Slow")
)
-
Find Outliers: Values beyond 2 standard deviations from the mean:
if(abs(Amount - allAvg(Amount)) > 2 * sqrt(allVariance(Amount)),
"Outlier", "Normal")
-
Compare to Benchmarks:
Duration > allPercentile(Duration, 0.9) // Is this in the top 10% (slowest)?
allPercentile
(attribute, percentile) Calculates an attribute's percentile value across all events.
| Parameters | | attribute | number | The attribute to analyze | | percentile | number | The percentile as a fraction from 0 to 1 (0.95 = 95th percentile) | |
| Returns | number |
| Examples | allPercentile(Duration, 0.95) → 95th percentile duration overall |
allVariance
(attribute) Calculates an attribute's variance across all events.
| Parameters | | attribute | number | The attribute to analyze | |
| Returns | number |
| Examples | allVariance(Amount) → Variance of amounts across all events |