Aggregate block

  • Updated

An aggregate block summarizes a property or block by applying an aggregation function to the input property and potentially organizing the results into groups.

Use the following fields to configure the block:

  • Aggregator – Choose a function to aggregate input for a block.
    • avg – Compute the average of the input values.
    • count – Count the total number of input values, including duplicates.
    • unique count – Count the number of unique input values.
    • first – Compute the first input value, determined by ordering inputs by event time.
    • last – Compute the last input value, determined by ordering inputs by event time.
    • max – Compute the maximum input value.
    • min – Compute the minimum input value.
    • sum – Sum input values.
  • Input – Provide input for the aggregator block. It can be a property, block, value, or parameter.
  • Group by – (Optional) Group the output of the aggregator block by specified attributes. Each attribute can be a property or a block.

Example

To calculate the number of user IDs,

  1. Select count as the aggregator.
  2. Select id from the Users dataset.
  3. Click Apply.
  4. Click Run.

opti-aggr.png

Output

The aggregate block produces a numerical value. If you use the Group by option, the output may include a grouping attribute.

You can use the aggregate block to calculate the average revenue per user.

  1. Click + > Metric > Aggregate.
  2. Calculate the total ad revenue per user in the first aggregate block. Select sum as the aggregator and the Incremental Campaign Revenue derived column as the value.
  3. Click + > Users in the Group by Property section. Name this block Ad revenue per user.
  4. Add another aggregate block to calculate the Average revenue per user. Select avg as the aggregator and the previously created Ad revenue per user block as the value.
  5. Click Run.
oa-aggblock.png