Aggregate functions overview

Aggregate functions evaluate multiple rows of data to return a single value. For example, you can use aggregate functions to perform group calculations (like Sum and Avg), retrieve specific values (like Min and Max), assess the data to provide insights (like Count and CountDistinct), or join multiple values (like ArrayAgg and ListAgg).

ArrayAggJoins the values of a group or column into a single array
AvgCalculates the average value of a column or group.
AvgIfCalculates the average value of a column or group when the specified condition is True.
CorrCalculates the Pearson correlation coefficient (bivariate correlation) of two columns.
CountCounts the number of non-null and non-empty values in a column or group.
CountDistinctCounts the number of unique non-null and non-empty values in a column or group. Does not count duplicate values. (Same as Ndv.)
CountDistinctIfCounts the number of unique non-null and non-empty values in a column or group when the specified condition is True. Does not count duplicate values.
CountIfCounts the number of non-null and non-empty values in a column or group when the specified condition is True.
GrandTotalCalculates the grand total for column or group.
ListAggJoins the values of a group or column into a single text string.
ListAggDistinctJoins the unique values of a group or column into a single text string. Does not include duplicate values.
MaxRetrieves the maximum (largest or latest) value in a column or group.
MaxIfRetrieves the maximum (largest or latest) value in a column or group when the specified condition is True.
MedianDetermines the median (midpoint) value of a column or group.
MinRetrieves the minimum (smallest or earliest) value in a column or group.
MinIfRetrieves the minimum (smallest or earliest) value in a column or group when the specified condition is True.
NdvCounts the number of unique non-null and non-empty values in a column or group. Does not count duplicate values. (Same as CountDistinct.)
PercentileContCalculates the continuous kth percentile of a column or group.
PercentileDiscCalculates the discrete kth percentile of a column or group.
PercentOfTotalCalculates the percentage a value contributes to the specified aggregate total.
StdDevCalculates the standard deviation of a column or group.
SubtotalCalculates the subtotal of a column or group.
SumCalculates the sum of a column or group.
SumIfCalculates the sum of a column or group when the specified condition is True.
SumProductCalculates the product of row values across specified columns, then calculates the sum of the resulting products for a column or group.
VarianceEstimates the sample variance (spread of distribution) of a column or group.
VariancePopCalculates the population variance (spread of distribution) of a column or group.