SQLRollingStats released

Compute running totals, moving averages, and many other statistics that need relative row references, within T-SQL.
July 26, 2011 - 13:39
Press Release
SQLRollingStats released
Functions included in SQLRollingStats.

SQLRollingStats is a solution for SQL Server that extends and enhances your T-SQL programming environment by adding 30+ statistical window functions - allowing the computation of results per row that depend on values in other rows. All functions are capable of taking into account all rows so far processed, or just the last n rows where n is the specified window size. Functions include: 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.


  • 30+ scalar functions that return results based on data from current row and prior rows in the same query.All functions support a rolling window that discards older values, or can be cumulative (no window)
  • All functions support tiling (accumulation of data restarts when input row number restarts from 1)
  • All functions provide checking & enforcement of row-processing order using row number inputs
  • Sum and product
  • Maximum, minimum, range and mid-range
  • First (for a window size of n will return input from n rows ago) and Previous (value from prior row)
  • Average (mean), sample & population variance, sample & population standard deviation
  • Geometric mean, harmonic mean, quadratic mean
  • Weighted average, sample & population variance, sample & population standard deviations. 
  • Exponentially weighted average, variance and standard deviations
  • Weighted power mean (generalized mean)
  • Median, quartile, inter-quartile range, tri-mean
  • Percentile & percentile rank

About TotallySQL

TotallySQL are specialists in application development centered around Microsoft SQL Server, and in particular in creating CLR-based function libraries that enable advanced processing to be carried out within the database itself. They provide a range of off-the-shelf function libraries and can also build bespoke libraries to your specification. They also provide a range of database and data management services - including database design, ETL services, data cleansing and data migration.