SQLRollingStats extends the T-SQL scripting environment with 31 windowed or cumulative functions (in which results for each row depend on previous rows) that can be used as regular functions in queries.
This allows metrics such as running totals or moving averages to be easily calculated within simple queries - something that has hitherto been a significant challenge in SQL Server.
All the functions support windowing (such that only values from the last n rows are included in the input set - where n is the window size), cumulative operation (where all prior values are counted), and tiling (so the accumulation is restarted for each distinct value of a given column).
- Sum, product, maximum, minimum, range, mid-range, first (in sequence), nth previous.
- Average (mean), variance (sample & population), standard deviation (sample & population).
- Geometric mean, harmonic mean, quadratic mean.
- Median, quartile, inter-quartile range, tri-mean, percentile, percentile rank.
- Exponential average (mean), exponential variance, exponential standard deviation.
- Weighted average, weighted variance (sample & population), weighted standard deviation (sample & population), weighted power mean.