Solved

MOVINGSUM with a variable/metrics as WINDOW SIZE

  • 19 August 2023
  • 5 replies
  • 183 views

Userlevel 2
Badge +1
  • Occasional Observer
  • 4 replies

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

icon

Best answer by Fabien 24 August 2023, 09:12

View original

5 replies

Userlevel 6
Badge +12

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

Thanks

Userlevel 3
Badge

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.

Userlevel 2
Badge +1

Yeap, all clear. Many thanks for your help!

Adam

Userlevel 5
Badge +8

Great to hear! :)

Userlevel 6
Badge +12

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]

 

Reply