Supported aggregations

Last updated:

|Edit this page

This is an ever-expanding list of enabled aggregations.

You can find their full definitions in the ClickHouse documentation. Additionally, we include a list of popular ones and their uses in the HogQL expressions and SQL insight documentation.

Standard aggregate functions

  • count
  • countIf
  • min
  • minIf
  • max
  • maxIf
  • sum
  • sumIf
  • avg
  • avgIf
  • any
  • anyIf
  • stddevPop
  • stddevPopIf
  • stddevSamp
  • stddevSampIf
  • varPop
  • varPopIf
  • varSamp
  • varSampIf
  • covarPop
  • covarPopIf
  • covarSamp
  • covarSampIf

ClickHouse-specific aggregate functions

  • anyHeavy
  • anyHeavyIf
  • anyLast
  • anyLastIf
  • argMin
  • argMinIf
  • argMax
  • argMaxIf
  • avgWeighted
  • avgWeightedIf
  • groupArray
  • groupUniqArray
  • groupArrayInsertAt
  • groupArrayInsertAtIf
  • groupArrayMovingAvg
  • groupArrayMovingAvgIf
  • groupArrayMovingSum
  • groupArrayMovingSumIf
  • groupBitAnd
  • groupBitAndIf
  • groupBitOr
  • groupBitOrIf
  • groupBitXor
  • groupBitXorIf
  • groupBitmap
  • groupBitmapIf
  • groupBitmapAnd
  • groupBitmapAndIf
  • groupBitmapOr
  • groupBitmapOrIf
  • groupBitmapXor
  • groupBitmapXorIf
  • sumWithOverflow
  • sumWithOverflowIf
  • deltaSum
  • deltaSumIf
  • deltaSumTimestamp
  • deltaSumTimestampIf
  • sumMap
  • sumMapIf
  • minMap
  • minMapIf
  • maxMap
  • maxMapIf
  • skewSamp
  • skewSampIf
  • skewPop
  • skewPopIf
  • kurtSamp
  • kurtSampIf
  • kurtPop
  • kurtPopIf
  • uniq
  • uniqIf
  • uniqExact
  • uniqExactIf
  • uniqHLL12
  • uniqHLL12If
  • uniqTheta
  • uniqThetaIf
  • simpleLinearRegression
  • simpleLinearRegressionIf
  • contingency
  • contingencyIf
  • cramersV
  • cramersVIf
  • cramersVBiasCorrected
  • cramersVBiasCorrectedIf
  • theilsU
  • theilsUIf
  • maxIntersections
  • maxIntersectionsIf
  • maxIntersectionsPosition
  • maxIntersectionsPositionIf

Questions? Ask Max AI.

It's easier than reading through 623 docs articles.

Community questions

Was this page useful?

Next article

SQL variables

SQL variables allow you to create configurable, reusable queries by defining placeholders that can be dynamically replaced with different values. Using variables in SQL queries You must first create a variable in the variable sidebar pane. Once created, variables in PostHog SQL are defined using the {variables.<variable-name>} syntax. When you write a query with variables, you'll be prompted to provide values for each variable. For example, this query uses a variable to filter events by a…

Read next article