# 2. Query Block - Metric

Last updated

Last updated

Metric

The "metric" section is an essential component of creating a query and must include at least one metric.

In this section, you determine how to calculate the selected table using specific values and measurements. You can take advantage of different functions and arithmetic operations, or freely input your own custom formula.

How to use

You can add a table to the Metric section by either entering the name of the column you want to add directly or by dragging it from the panel on the left.

You can change the name of the metric after adding a column from the table by using the input window that appears on the right. The name of the metric can consist of alphanumeric characters and underscores (_), but it cannot start with a number. If a name is not provided, a random name will be assigned.

To add additional metrics, click the "+ Metric" button.

Click the "Save and Run" button to give a title to the query and save it. The result table will become available below once the query calculation is completed.

Function

Aggregate Function This function includes options such as Sum, Count, Min, Max, and Average, and determines how the rows in a column will be summarized horizontally When you have chosen to use the Datetime aggregation option or have added a column to the group by section, you must use an aggregate function in the metric section. If you haven't selected the aggregation option, do not use an aggregate function. When multiple operations are utilized, the final function applied must be an aggregate operation.

Scalar Function

The Scalar functions determine how to perform calculations between multiple columns. They can be used freely regardless of whether an aggregation has taken place or not.

Arithmetic Operation You can directly input the symbols *, /, +, - to perform arithmetic operations between columns or between a column and a number.

Nested Operation You can perform nested operations using parentheses, which allows you to add the results of other functions within a function, and use arithmetic operations within a function.

You can also use all of the other functions available in BigQuery.