# Window and Calculate Node

### Description

Use the Window and Calculate node to calculate a metric for each row, by looking at other rows in the chosen window. This node is great for calculating a 7-day moving average or cumulative sum in a certain metric.

### Option

Window: select column to select a certain range and determine the order (ascending or descending)

Aggregation method: the method to aggregate a value, e.g. SUM, COUNT, AVERAGE, RANK, etc

Value: the column to perform the aggregate method on

##### Example 1: 7 day moving average

Order the rows by date, and for each row, take the average of a 7 row window.

##### Example 2: Cumulative sum over time:

Order the rows by time, and for each row, take sum of all the preceding rows

##### Example 3: Best ranking collateral in each campaign:

Group by campaign, order by performance, generate the rank number for each one, then use a filter node to select rows with rank number = 1.

↩️ Back to Workflow Settings

Updated on: 05/10/2024

Thank you!