9 Replies Latest reply on Jan 16, 2017 7:14 PM by Shinichiro Murakami

How to calculate 4 week average

Hi all,

Below is the example of my workbook,

I want to show 4 weeks average forecast by model so I cannot use WINDOW_AVG function.

My data looks like this:

For example, the 4 week average forecast value for week 45 will be (wk 44+ wk 43 + wk 42 + wk 41) / 4

I was using datediff function at first but it didn't work...which function should I use to get this value?

Thanks,

Claire

• 1. Re: How to calculate 4 week average

You want this to show in a second column on the right ?

• 2. Re: How to calculate 4 week average

I want to show value under 4 week forecast column in the first picture. It's all 0 now because my calculation is wrong.

• 3. Re: How to calculate 4 week average

Window_avg / window_sum does not work?

[Forecast]

window_sum(sum([Value]),-4,-1)/4

Thanks,

Shin

• 4. Re: How to calculate 4 week average

It will work if it's by week but I'm going to put 4 weeks forecast average by model.

Thanks!

• 5. Re: How to calculate 4 week average

[BpWW 2]

if [Param WW]>=([Bp Ww]-1) then [Bp Ww] end

last()

if [Param WW]>=attr([Bp Ww]) then last() end

[4 Weeks Avg]

(window_sum(if [last()]<=5 and [last()]>=2 then sum([Value]) end))/4

Thanks,

Shin

2 of 2 people found this helpful
• 6. Re: How to calculate 4 week average

Hi Shin,

Thanks for the thorough answer! But I encountered some issues on following  your instruction.

I'm not able to select the level and the restarting buttons, I can only addressing it to model and shows compute using model...

Thanks,

Claire

• 7. Re: How to calculate 4 week average

This button does not work?

Shin

1 of 1 people found this helpful
• 8. Re: How to calculate 4 week average

Hi Shin,

Thank you so much for the reply. End up I added this calculation in Alteryx.

Thank you again.

Claire

• 9. Re: How to calculate 4 week average

Then, could you mark my answer as correct.

Thanks,

Shin