{{ transformations:SlidingAggregationAction.png}}
====== SLIDING AGGREGATION ======
Category: Transform / Advanced \\
\\
=====Description=====
This action calculates an aggregate, such as //average//, of N sliding values.
Available aggregations:
* Average
* Sum
* Min
* Max
* Count Distinct
\\
=====Use cases=====
This action can be used for adding smoothed trendlines to charts.
\\
=====Action settings=====
^Setting^Description^
|New column|Enter the name of the column that will contain the aggregated values.|
|Target column|Select the name of the column containing the values to be aggregated.|
|Aggregation mode|Select the aggregation method to be used on the values in the Target column. Options: //Average//, //Sum//, //Min//, //Max//, or //Count Distinct//.|
|Window size*|Enter the number of consecutive rows to be included in the calculation.|
|Offset to|Select whether the calculated values in the //New column// will align with the top ("start") of the window, or the bottom ("end"). Options: //Window start// or //Window end//.|
|In groups|Check this "on" and select one or more columns to group the aggregated results in.|
* Setting can be specified using a [[:parameters|parameter]].\\
\\
=====Remarks=====
The //Window size// determines how many rows' values are included within each calculation. A //Window size// of "4" includes 4 consecutive rows. The //Offset to// selection determines whether the output value aligns with the top/start or bottom/end of the current window.
If there aren't enough rows within the dataset or a //group// (if grouping is used) the //Window size// will be set to the number of available rows and a single calculation will be generated for that window.
\\
=====Examples=====
{{transformations:slide_agg_pic1.png?1077}}
\\
{{transformations:slide_agg_pic2.png?718}}
\\
=====See also=====
* [[transformations:aggregate|Aggregate]]