We're Moving!

The Vertica Forum is moving to a new OpenText Analytics Database (Vertica) Community.

Join us there to post discussion topics, learn about

product releases, share tips, access the blog, and much more.

Create My New Community Account Now


calculate moving average with user conditions — Vertica Forum

calculate moving average with user conditions

Hi

I have data which looks like below.

 

month  Sale

1           100

2           120

3            85

4            70

5            50

6            220

7            180

 

I need to calculate moving average base on user requirement where he can give whether it should be 3 months or 4 months calculating. For example if he calculates at month 1 with 3 months average then it should take sale figures of months 1,2,3 and should calculate averge for month 4 .   like wise it should take sales figures for  months of 2,3,4   to calculate average for month 5 .

please do help me on this.

 

Thank You

 

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file