4. Query Block - Group by

Group by

The Group by section is used when you want to group the data in a table based on a certain criterion by creating multiple categories from a single column. For example, you can use it to view the total number of transactions sent by each address, or to compare the prices of all tokens. By using Group by, you can obtain the results of the calculation of Metrics for each group segment.

One thing to note is that as soon as you add a Group by clause, you will be calculating aggregated summaries for each group segment. Therefore, when calculating metrics, you should use an aggregate function for them to avoid errors.

How to use

  1. You can click on the Group by input box and select the column you want to group by from the column list, or you can drag and drop the column from the left pane into the input box.

  2. For a numeric column, the bin option is provided to create groups based on the range of values. Meaning, the system will calculate and categorize the data by the number of categories that you want to see. After selecting the column, you can choose one of the bin options to complete the addition. The range of the entire numbers is divided into groups of equal size based on the number of bins selected.

  3. Adding another Group by

    1. You can add a new Group by by clicking the +Group by button at the top or dragging a column from the left pane into the Group by area.

    2. If you set multiple Group bys, you can divide the groups into subgroups to view them. Since the subgroups are formed in the order they were added, be aware of the order.

Group by Metadata

When setting up a Group by, you can use not only the data in the original table but also metadata information. For example, you can group the address column by the name of the address owner.

How to use

  1. First, select the column to use in the Group by, then select Group by Metadata from the condition dropdown.

  2. When you select it, an input field will appear asking you to choose which metadata field to match with.

    For example, if the column you want to filter corresponds to an Ethereum address, select 'Ethereum Address'.

  3. After selecting the matching field, choose which information to use to Group by. For example, if you want to group by the entity name of the address owner, select 'Entity Name'.

Last updated