Running Total Statistical Functions

Running Total Statistical Functions calculate the standard deviation or variance using all values up to the current date for a fact or metric. Functions are available for standard deviation, variance, and versions of those functions for populations. See Standard Deviation Functions and Variance Functions.

Suppose you are tracking daily production for your enterprise throughout the month in a simple visualization tracking daily Units. You can use the RUNAVG and RUNSTDEV statistical functions to track the reliability of estimates as the month begins to close:

DateUnitsRunning Avg Daily UnitsRunning StDev
06/02/20145050.00(blank value)
06/03/20146055.007.07
06/04/20147060.0010.00
06/05/20145057.509.57
06/06/20146058.008.37
06/09/20148061.6711.69
06/10/20145060.0011.55
06/11/20147061.2511.26
06/12/20146061.1110.54
06/13/20148063.0011.60

Running total metrics can be broken down by two or more date attributes from the same date dimension. Non-date attributes are not supported.

Syntax

SELECT RUNSTDEV(...)
SELECT RUNSTDEVP(...)
SELECT RUNVAR(...)
SELECT RUNVARP(...)
SELECT RUNSTDEV(...) WITHIN (...)

The value for WITHIN must be a date attribute.

SELECT RUNSTDEV(...) WITHIN (ALL OTHER)

Examples

SELECT RUNVAR({fact/sales})
SELECT RUNSTDEVP({metric/leads}) WHERE {label/date_ordered.year} = THIS
SELECT RUNVARP({metric/returns}) WHERE {metric/amount} > 500000
SELECT RUNSTDEV({metric/opportunities}) WITHIN ({label/date_ordered.quarter_year})