Skip to content

[Feature Request]: Moving Average (Last N Events) in (Memory) Group By Step #7023

@dmainou

Description

@dmainou

What would you like to happen?

Summary

Add support in the Group By and ** Memory Group By** transforms to calculate a moving average over the last N events within each group.

Problem

Current aggregation functions operate on the full group only (e.g. sum, avg, min, max). There is no native way to compute a rolling/moving average within a group without additional steps or custom logic.

Proposed Solution

Introduce a new aggregation type:

  • Moving Average (Last N Events)

With configuration options:

  • Field to aggregate
  • Window size (N)
  • Order field (to define event sequence within the group)

Example

For a group customer_id, calculate:

  • Moving average of transaction_amount
  • Over last N = 5 events
  • Ordered by transaction_timestamp

Expected Behaviour

  • Resets per group
  • Respects defined sort/order field
  • Outputs a new field with the rolling average

Benefits

  • Simplifies common analytical patterns
  • Reduces need for multiple transforms or scripting
  • Improves readability and maintainability of pipelines

Additional Notes

  • Should handle edge cases where fewer than N events exist (e.g. return null's for partial window)
  • Performance considerations for large datasets should be taken into account

Issue Priority

Priority: 3

Issue Component

Component: Hop Gui

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions