running_total_m
Add a running total to Power BI tables, ordered by a column and optionally resetting per group, using a fast single-pass accumulation instead of slow row-by-row recalculation.
Instructions
Add a FAST running total of valueColumn ordered by orderColumn, optionally restarting within each groupColumn. Uses List.Buffer + a single accumulation pass (O(n)) rather than a per-row re-scan (O(n^2)). Appends sort + index + running-total steps to the table's M query.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | ||
| sessionId | Yes | ||
| groupColumn | No | the partition column to reset within (optional) | |
| orderColumn | Yes | the column that orders the rows | |
| valueColumn | Yes | the value column to accumulate | |
| partitionName | No | partition name (optional; defaults to the first partition) |