variancep — aggregate function to return the population variance of a range of values.
This function computes a value for each record returned by the query predicate, or from the specified column of a base table, and returns the population variance of those values.
This variancep() function is similar to the variance() function, but is calculated using the biased (or n) method. The variancep() function is usually used when the incoming data represents the entire population of data. Use variance() instead when the incoming data represents a random sample.
expr must include the name of a
column in a LiveView table, where that column's data type is int, long, or double.
The returned value is of type double.
This example shows how to use dynamic aggregation to find the population variance of the values in a column. In the Hello LiveView sample, create a query that finds the population variance of the quantityRemaining field from the ItemSales table, grouping by Item. Follow these steps:
In LiveView Desktop connected to a server running the Hello LiveView sample, select the ItemsSales table from the Tables pane of the LiveView Tables view.
In the Select field, enter:
category, variancep(quantityRemaining) AS popvarQuantity
In the Query field, enter the following:
group by category
The query results open in a grid view. LiveView Server recalculates the population variance value whenever the rows returned by the query predicate change.
This LiveView aggregate function is based on the variancep aggregate function in the StreamBase expression language.