Group is often used when you try to "bucket" data together.
The first part is called Group by. This is where you specify the fields that should be used to group the input data. The field you select here is called a group key and each group key should be unique. For example, you can group all the transactions by the sender's wallet address.
A group key can also be an object:
If the group key you choose happen to be a timestamp, there will be an extra option for different intervals. It's especially handy when you are building a daily, weekly or monthly chart.
The second part is called Accumulation. This is where you decide how the data that's been grouped together should be handled. There is a list of accumulators to help you achieve that. Let's look at some simple examples:
You can put all of them into an array by using
If you want to get an average value of all the data, you can use
If you want to get a total value of all the data, you can use