Alteryx Designer Desktop Discussions

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

count sum based on above data

Dima1
7 - Meteor

Hi All

 

I have 2 columns:number of month and revenue. Need to create 3rd column where to show average revenue for last 2 months.

 

For example

N   Rev  AvR

1   2   -

2   4   -

3   6   3

4   8   5

and so on

 

Could you please advise whats the easiest way to do this? I can split it manually and then count sum and then union again, but for sure there should be faster way.

 

Thanks in advance.

 

2 REPLIES 2
Joe_Mako
12 - Quasar

One option is to use the Multi-Row Formula tool, with:

- Num Rows set to 2

- Value for Rows that don's Exist set to NULL

- Expression: ([Row-2:Rev]+[Row-1:Rev])/2

- You can also use the Group By to partition, or restart.

 

The combination of using addition and NULL config result in a Null value when there are not two prior records.

 

Avg Rev.png

Dima1
7 - Meteor

God bless you! That worked! 

Labels