2. Query Block - Metric
Metric
The "metric" section is an essential component of creating a query and must include at least one metric.
![](https://userguide.cryptoquant.com/~gitbook/image?url=https%3A%2F%2Fdownloads.intercomcdn.com%2Fi%2Fo%2F687210631%2F8dfc644eb98ef669454abd1d%2Fmetric1.png&width=768&dpr=4&quality=100&sign=262adfa1&sv=1)
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.
![](https://userguide.cryptoquant.com/~gitbook/image?url=https%3A%2F%2Fdownloads.intercomcdn.com%2Fi%2Fo%2F687210902%2Fd8dceba2244edca9dbd7776c%2Fmetric2.png&width=768&dpr=4&quality=100&sign=ba4f91ac&sv=1)
How to use
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.
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.
Last updated