Good morning, how are you? I wanted to know if the...
# gooddata-platform
t
Good morning, how are you? I wanted to know if there's a metric statement that allows me to replicate the behavior of the running sum executed with a right-click. I've attached an example: As you can see in the example, the running sum accumulates the column to its left.
j
Hello Tomas, Yes. You can reproduce the right‑click “Running Sum” with a MAQL metric using the
RUNSUM
function. For a basic running sum of a fact/metric:
SELECT RUNSUM({metric/TEST_DHS_3})
or, if you are summing a fact directly:
SELECT RUNSUM({fact/facturacion_equivpr})
This behaves like the UI running total: each row’s value is added to the previous rows’ values in the current date sequence. [*Running totals core*; Metric running totals] If you need the running sum to restart within a period (for example, per year), add
WITHIN
with a date attribute:
SELECT RUNSUM({metric/TEST_DHS_3}) WITHIN ({label/date.year})
t
Good morning, how are you? The Runsum function only accumulates based on date attributes, not alphanumeric attributes like those in the example I shared. Is there another function that allows me to replicate the run sum function with a right-click?