Skip to content

Query the sample standard deviation and population standard deviation of the pre-tax income

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

SQL
|
SELECT
  stddev(PretaxGrossAmount) as "Sample standard deviation",
  stddev_pop(PretaxGrossAmount) as "Population standard deviation",
  time_series(__time__, '1m', '%H:%i:%s', '0') as time
GROUP BY
  time