dbr.running_total
- Calculate running total for a column
select 'dbr.running_total', ColumnRef [, SourceColumnRef ]
A running total is the cumulative sum of a specified column that increments or decrements row by row.
The command offers two options: when only one parameter is provided, the running total is computed over the specified column. If a second parameter is provided, the first parameter's column accumulates the running total based on values from the second column. Running totals can be utilized in both tabular reports and charts.
A 'Running total' column calculates its values based on the column itself, while 'Running total 2' derives its values from the 'Revenue' column.
select 'dbr.running_total', 'Running total'; select 'dbr.running_total', 'Running total 2', 'Revenue'; select revenue_month as 'Month', revenue as 'Revenue', revenue as 'Running total', null as 'Running total 2' from mydb.data;