Integrate Software AG Products Using Digital Event Services : MashZone NextGen Help : Appendix : Legacy Presto components : MashZone NextGen Analytics : RAQL Queries : Running Aggregates
Running Aggregates
You can get cumulative calculations, also known as running totals, using aggregate analytic functions over partitions or windows defined in Over clauses. Normally, aggregate analytic functions return a single value for all rows in a partition or window, such as the Multi-Level Partitions example. If you add an Order By clause within the partition or window definition, however, aggregate functions return cumulative values based on the current row and all previous rows in the partition or window.
The following example uses the sum() aggregate analytic function to provide a running total of volumes for the stocks dataset introduced in Use an In-Memory Store to Store and Load Datasets for MashZone NextGen Analytics in Getting Started. The dataset is segmented into partitions by symbol plus the year in the date column and then ordered by the same column expression.
The runningTotal column is added to each row and calculated as a running sum for each symbol + year combination.
Copyright © 2017 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback