Skip to main content
Solved

MOVINGSUM with a variable/metrics as WINDOW SIZE

  • Aug 19, 2023 1:40 PM UTC
  • 5 replies
  • 730 views

Forum|alt.badge.img+1

Hi All, 

I am using MOVINGSUM which is very helpful but I stumbled on a challenge. 

I need to use a metrics as WINDOW SIZE rather than a fixed number. Basically the window size need to change dependently on month. I am getting the following error:

Error: Function MOVINGSUM requires second argument to be a scalar integer but is defined on Dimensions '00 Hub'::Month
Am I doing sth wrongly? Is there a workaround?

Regards,

Adam

Best answer by Fabien

Good morning,

This one was resolved yesterday during a session directly with Adam.
This is totally feasible by SELECTing the month in the driving metric of the window.

View original

5 replies

Benoit
Community Manager
Forum|alt.badge.img+17
  • Community Manager
  • Aug 19, 2023 8:27 PM UTC

Hi,
could you maybe share your formula? And the type and structure of your window size metric?

Thanks


Fabien
Employee
Forum|alt.badge.img+3
  • Employee
  • Answer
  • Aug 24, 2023 7:12 AM UTC

Good morning,

This one was resolved yesterday during a session directly with Adam.
This is totally feasible by SELECTing the month in the driving metric of the window.


Forum|alt.badge.img+1
  • Author
  • Wallflower
  • Aug 24, 2023 7:27 AM UTC

Yeap, all clear. Many thanks for your help!

Adam


Benji
Wallflower
Forum|alt.badge.img+9
  • Wallflower
  • Aug 24, 2023 7:27 AM UTC

Great to hear! :)


Benoit
Community Manager
Forum|alt.badge.img+17
  • Community Manager
  • Sep 4, 2023 12:31 PM UTC

Hi all,

Just a small note on this topic.

The resolution that Fabien offered was about finding an alternative formula without using Movingsum() because the window size argument can’t be dynamic.

Example:

Movingsum(Metric,3)

would be the same as doing

Metric + Metric[select:Month-1] + Metric[select: Month-2]