Running total last 12 months

Hi all,

I am trying to create a graph where each datapoint is the sum of the last 12 months sales. For example August is sales from Aug 2022 to Aug 2023, September is sales from Sep 2022 to Aug 2023.

I have managed to create running totals during a fixed period of time, but that is not what I need. I can't specify an offset in time using the  running_totals() command.

The data I have is time series where each datapoint has a transaction date and a sales amount.

Is this possible to do with a calculated field or a metric? 

Any help or pointers in the right direction would be appreciated!

Fred

0 1 431
1 REPLY 1

Have you tried something like this?

sum(offset_list(${measure},0,12))

offset list starts at 0 for same line, so if you want to include the current month or 1 if you want to go back 1 month. Then it will sum the last 12 from there.

You may need to play with it a bit but if you try using offset_list() without the sum then you'll see exactly what it's picking up.

Top Labels in this Space