Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Average for each three months

Ecaterina
7 - Meteor

Hello,


I have the next situation.
I need to calculate a revenue for the December which are an average for the last three months.
The exact situation.

 

KPDateAmounts
Revenue2019-09-0111112
Revenue2019-10-011125
Revenue2019-11-012563

 The revenue for December will be AVG(amounts).

 

Then I want to save this value in DB  and I will have the next value in a table.

KPDateAmounts
Revenue2019-09-0111112
Revenue2019-10-011125
Revenue2019-11-012563
Revenue2019-12-014933

 

Then the revenue for January will be avg for the last three months and the avg will be save in db.

 

How to do this in for one year?

6 REPLIES 6
WilliamR
Alteryx
Alteryx

Hi @Ecaterina ,

do you want the process to be executed once a month over the last three months?

Ecaterina
7 - Meteor

I want to run for one  year. The value for the next month is the avg for the previous  three months.

I know the value for September, October and November then I can calculate the value for December.

For January will be average for October , November and the value which I calculate for December.

meljaafari
Alteryx Alumni (Retired)

Hey @Ecaterina,

 

I attached a workflow which may help you achieve the result you want.

It generates a new row (or multiple rows ups to the current month) every time you run the workflow, and calculates the running average based on the Amounts value for the 3 months prior.

 

Hope this helps,

Mo

Ecaterina
7 - Meteor

Thanks for the work flow, it is work fain, but I also need to add the iteration  part. After is calculate the value for December I need to calculate for January until next year December.

RolandSchubert
16 - Nebula
16 - Nebula

Hi @Ecaterina ,

 

I've extended the workflow created by @meljaafari a bit to include the iteration. You can create additional periods by modifying the condition expression within the Generate Rows tool, I used "< DATETIMEADD([Max_date], 12, 'month') to generate 12 periods. Average is calculated by using the Multi-Row formula tool.

 

27-12-_2019_14-51-27.png

 

I've attached a sample worklflow, hope this is helpful.

 

Best,

 

Roland

 

Ecaterina
7 - Meteor

Hi @,

 

 

 

Labels