Skip to content

Query the sample variance and population variance of the pre-tax income

To query the sample variance and population variance, perform the following operations: Use the time_series function to aggregate the data by time, use the var_pop function to calculate the population variance, and then use the var_samp or variance function to calculate the sample variance. The results are displayed in a line chart.

SQL
|
SELECT
  var_samp(PretaxGrossAmount) as "Sample variance",
  var_pop(PretaxGrossAmount) as "Population variance",
  time_series(__time__, '1m', '%H:%i:%s', '0') as time
GROUP BY
  time