CUME function is used to find running total. Similar to Moving Sum and Moving AVG.

CUME funciton adds the current row value to previous total and makes it as new total.

Syntax

When a row has null value, CUME retains previous total. If all the rows have NULL value, CUME returns NULL for all rows.

Example : Find history of page views provided monthly page views

CUME funciton adds the current row value to previous total and makes it as new total.

Syntax

CUME( numeric_value [, filter_condition] )

Argument | Required/Optional | Description |
---|---|---|

numeric_value | Required Numeric datatype. Passes the values for which you want to calculate a running total. You can enter any valid transformation expression. You can create a nested expression to calculate a running total based on the results of the function as long as the result is a numeric value. | |

filter_condition | Optional Limits the rows in the search. The filter condition must be a numeric value or evaluate to TRUE, FALSE, or NULL. You can enter any valid transformation | |

expression. |

When a row has null value, CUME retains previous total. If all the rows have NULL value, CUME returns NULL for all rows.

Example : Find history of page views provided monthly page views

Month | Page Views | Total |
---|---|---|

Aug | 300 | 300 |

Sep | 400 | 700 |

Oct | 500 | 1200 |