* cumulative sum
* refactor and create new mode
* refactor - use reduceOptions for new mode also
* revert naming
* Add window function, rename statistical to cumulative (#77066)
* Add window function, rename statistical to cumulative
* Fix merge errors
* fix more merge errors
* refactor + add window funcs
Co-authored-by: Oscar Kilhed <oscar.kilhed@grafana.com>
* add ff + tests + centered moving avg
Co-authored-by: Oscar Kilhed <oscar.kilhed@grafana.com>
* make sum and mean cumulative more efficient (#77173)
* make sum and mean cumulative more efficient
* remove cumulative variance, add window stddev
* refactor window to not use reducer for mean. wip variance stdDev
* fix tests after optimization
---------
Co-authored-by: Victor Marin <victor.marin@grafana.com>
* optimize window func (#77266)
* make sum and mean cumulative more efficient
* remove cumulative variance, add window stddev
* refactor window to not use reducer for mean. wip variance stdDev
* fix tests after optimization
* fix test lint
* optimize window
* tests are passing
* fix nulls
* fix all nulls
---------
Co-authored-by: Victor Marin <victor.marin@grafana.com>
* change window size to be percentage
* fix tests to use percentage
* fixed/percentage window size (#77369)
* Add docs for cumulative and window functions of the add field from calculation transform. (#77352)
add docs
* splling
* change WindowType -> WindowAlignment
* update betterer
* refactor getWindowCreator
* add docs to content.ts
* add feature toggle message
---------
Co-authored-by: Oscar Kilhed <oscar.kilhed@grafana.com>
@ -127,6 +127,7 @@ You can perform the following transformations on your data.
Use this transformation to add a new field calculated from two other fields. Each transformation allows you to add one new field.
- **Mode -** Select a mode:
- **Reduce row -** Apply selected calculation on each row of selected fields independently.
- **Binary operation -** Apply basic binary operations (for example, sum or multiply) on values in a single row from two selected fields.
- **Unary operation -** Apply basic unary operations on values in a single row from a selected field. The available operations are:
@ -135,7 +136,32 @@ Use this transformation to add a new field calculated from two other fields. Eac
- **Natural logarithm (ln)** - Returns the natural logarithm of a given expression.
- **Floor (floor)** - Returns the largest integer less than or equal to a given expression.
- **Ceiling (ceil)** - Returns the smallest integer greater than or equal to a given expression.
- **Cumulative functions** - Apply functions on the current row and all preceding rows.
**Note:** This mode is an experimental feature. Engineering and on-call support is not available.
Documentation is either limited or not provided outside of code comments. No SLA is provided.
Enable the 'addFieldFromCalculationStatFunctions' in Grafana to use this feature.
Contact Grafana Support to enable this feature in Grafana Cloud.
- **Total** - Calculates the cumulative total up to and including the current row.
- **Mean** - Calculates the mean up to and including the current row.
- **Window functions** - Apply window functions. The window can either be **trailing** or **centered**.
With a trailing window the current row will be the last row in the window.
With a centered window the window will be centered on the current row.
For even window sizes, the window will be centered between the current row, and the previous row.
**Note:** This mode is an experimental feature. Engineering and on-call support is not available.
Documentation is either limited or not provided outside of code comments. No SLA is provided.
Enable the 'addFieldFromCalculationStatFunctions' in Grafana to use this feature.
Contact Grafana Support to enable this feature in Grafana Cloud.
- **Mean** - Calculates the moving mean or running average.
- **Stddev** - Calculates the moving standard deviation.
- **Variance** - Calculates the moving variance.
- **Row index -** Insert a field with the row index.
- **Field name -** Select the names of fields you want to use in the calculation for the new field.
- **Calculation -** If you select **Reduce row** mode, then the **Calculation** field appears. Click in the field to see a list of calculation choices you can use to create the new field. For information about available calculations, refer to [Calculation types][].
- **Operation -** If you select **Binary operation** or **Unary operation** mode, then the **Operation** fields appear. These fields allow you to apply basic math operations on values in a single row from selected fields. You can also use numerical values for binary operations.