BigQuery
Aggregate28 fungsi

Fungsi Aggregate BigQuery

Fungsi untuk menghitung nilai dari kumpulan data. Temukan semua 28 fungsi aggregate di BigQuery lengkap dengan syntax, contoh, dan penjelasan bahasa Indonesia.

28 fungsi aggregate di BigQuery

← Semua fungsi BigQuery

ANY_VALUE

Aggregate

Returns one value from a group non-deterministically. Useful for retrieving a value from a column that is not being aggregated when all values in the group are the same.

Tipe hasil: Same as input type

APPROX_COUNT_DISTINCT

Aggregate

Estimates the number of distinct values using the HyperLogLog++ algorithm. Much faster and less resource-intensive than COUNT(DISTINCT) for large datasets.

Tipe hasil: INT64

APPROX_QUANTILES

Aggregate

Calculates approximate quantile boundaries from numeric data. Uses an efficient approximate algorithm for large datasets, returning an array with n+1 elements.

Tipe hasil: ARRAY<T>

APPROX_TOP_COUNT

Aggregate

Returns the approximate most frequently occurring elements along with their counts. Uses a highly efficient approximate algorithm for large datasets.

Tipe hasil: ARRAY<STRUCT<value T, count INT64>>

APPROX_TOP_SUM

Aggregate

Returns the approximate elements with the highest total weight. Similar to APPROX_TOP_COUNT but ranked by sum of weights rather than count.

Tipe hasil: ARRAY<STRUCT<value T, sum INT64>>

ARRAY_AGG

Aggregate

Collects values from multiple rows into an ARRAY. A powerful BigQuery function for building nested data structures.

Tipe hasil: ARRAY<T>

ARRAY_CONCAT_AGG

Aggregate

Concatenates multiple arrays into a single array. Useful when each row already contains an array and you want to merge them all into one.

Tipe hasil: ARRAY<T>

AVG

Aggregate

Calculates the average (mean) of numeric values in a column. Ignores NULL values and supports multiple numeric types in BigQuery.

Tipe hasil: FLOAT64

BIT_AND

Aggregate

Performs a bitwise AND operation across all values in a group. Returns a value where each bit is 1 only if all input values have that bit set to 1.

Tipe hasil: INT64

BIT_OR

Aggregate

Performs a bitwise OR operation across all values in a group. Returns a value where each bit is 1 if at least one input value has that bit set to 1.

Tipe hasil: INT64

BIT_XOR

Aggregate

Performs a bitwise XOR operation across all values in a group. Returns a value where each bit is 1 if the number of input values with that bit set to 1 is odd.

Tipe hasil: INT64

CORR

Aggregate

Menghitung koefisien korelasi Pearson antara dua kolom numerik.

Tipe hasil: FLOAT64

COUNT

Aggregate

Counts the number of rows or non-NULL values in a column. A fundamental aggregate function in BigQuery for large-scale data analysis.

Tipe hasil: INT64

COUNTIF

Aggregate

Counts the number of rows that satisfy a given condition. Provides a more concise and readable syntax compared to COUNT with CASE or IF.

Tipe hasil: INT64

COVAR_POP

Aggregate

Menghitung kovarians populasi antara dua kolom numerik.

Tipe hasil: FLOAT64

COVAR_SAMP

Aggregate

Menghitung kovarians sample antara dua kolom numerik.

Tipe hasil: FLOAT64

LOGICAL_AND

Aggregate

Returns TRUE if ALL values in the group are TRUE. Acts as an aggregated AND operator, useful for verifying that every condition in a set is met.

Tipe hasil: BOOL

LOGICAL_OR

Aggregate

Returns TRUE if AT LEAST ONE value in the group is TRUE. Acts as an aggregated OR operator, useful for checking whether any condition in a set is met.

Tipe hasil: BOOL

MAX

Aggregate

Returns the maximum value from a column or expression. Supports numeric, string, date/time, and boolean types in BigQuery.

Tipe hasil: Same as input type

MIN

Aggregate

Returns the minimum value from a column or expression. Supports numeric, string, date/time, and boolean types in BigQuery.

Tipe hasil: Same as input type

STDDEV

Aggregate

Calculates the sample standard deviation of numeric values. Measures how spread out the data is from its mean. An alias for STDDEV_SAMP.

Tipe hasil: FLOAT64

STDDEV_POP

Aggregate

Calculates the population standard deviation of numeric values. Uses the N divisor formula (not N-1), suitable when the data represents an entire population.

Tipe hasil: FLOAT64

STDDEV_SAMP

Aggregate

Calculates the sample standard deviation of numeric values. Uses the N-1 divisor formula (Bessel's correction), suitable for sample data that represents a larger population.

Tipe hasil: FLOAT64

STRING_AGG

Aggregate

Concatenates string values from multiple rows into a single string with a specified delimiter. Very useful for creating lists or comma-separated values in BigQuery.

Tipe hasil: STRING

SUM

Aggregate

Calculates the total sum of numeric values in a column. Supports multiple numeric types and is highly efficient for large-scale data analysis in BigQuery.

Tipe hasil: Same as input type (INT64, FLOAT64, NUMERIC, or BIGNUMERIC)

VARIANCE

Aggregate

Calculates the sample variance of numeric values. Variance is the square of the standard deviation. This is an alias for VAR_SAMP.

Tipe hasil: FLOAT64

VAR_POP

Aggregate

Calculates the population variance of numeric values. Uses the N divisor formula, suitable when the data represents an entire population.

Tipe hasil: FLOAT64

VAR_SAMP

Aggregate

Calculates the sample variance of numeric values. Uses the N-1 divisor formula (Bessel's correction), suitable for sample data.

Tipe hasil: FLOAT64