COVAR_POP

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Computes the population covariance between two sets of values.

Syntax 

1covar_pop(<Y>, <X>)

Arguments 

Required 

  • <Y>: A double precision expression.
  • <X>: A double precision expression.

Returns 

Returns a double precision value representing the population covariance. Returns NULL if the computation is meaningless.

Considerations 

  • Returns NULL if there are no rows where both X and Y are non-null.
  • Population covariance uses N in the denominator.
  • Use COVAR_SAMP for sample covariance (uses N-1 in the denominator).

Examples 

Calculate Population Covariance 

Find the population covariance between two variables.

1SELECT covar_pop(height, weight) AS covariance
2FROM measurements;

Covariance by Group 

Calculate covariance for each group.

1SELECT region, covar_pop(sales, temperature) AS sales_temp_cov
2FROM regional_data
3GROUP BY region;

Related Documentation