Alteryx Designer Desktop Discussions

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

Consecutive Monthly Sales

RohanRoy
6 - Meteoroid

Hi

 

I have a scenario where there is data for 12 months sales for each Entity Where in I need to consider only the first three consecutive months sales. i.e., if Jan Feb March is having continuous sales then output only Jan Feb March Numbers, if no sales then move to next three consecutive month sales. it could be Feb March Apr or Apr May Jun or Aug Sep Oct or Oct nov Dec likewise any three also not to be considered if no three consecutive month sales.

Input :

Entity IDMonthSales
225January0
225February700
225March0
225April400
225May0
225June700
225July300
225August200
225September200
225October300
225November0
225December500
501January0
501February0
501March1200
501April0
501May0
501June0
501July1000
501August900
501September0
501October300
501November0
501December2000
202January2000
202February6000
202March2000
202April3000
202May4000
202June400
202July300
202August300
202September100
202October5000
202November400
202December5000
170January400
170February100
170March0
170April200
170May500
170June500
170July1000
170August1000
170September2000
170October2000
170November400
170December400

 

 

Expected Output

Entity IDMonthSales
225June700
225July300
225August200
202January2000
202February6000
202March2000
170April200
170May500
170June500
7 REPLIES 7
TimN
13 - Pulsar

This seems to work.  Have not tried with more data though..

RohanRoy
6 - Meteoroid
Thanks for the quick reply. But that's not working. Missing the consecutive months,
RohanRoy
6 - Meteoroid

Thanks for the quick reply. But that's not working. Missing the consecutive months,

TimN
13 - Pulsar

I think you just need to get the If Statement right in the Multi-Row tool.  I tried:

 

IF [Sales] > 0 and [Row+1:Sales]> 0 and [Row+2:Sales]> 0 THEN "Y"
ELSE
"N" ENDIF

 

Seems to be better but not sure if this will work for multiple years...

cjaneczko
13 - Pulsar

There is likely an easier way, but this seemed to work. 

 

image.pngimage.png

RohanRoy
6 - Meteoroid

Thanks Tim. That is working for the data which i shared but when I implemented on other entity, its not working.

Feb Mar Apr should be the output

 

101January0
101February800
101March300
101April300
101May0
101June500
101July300
101August600
101September100
101October700
101November0
101December600
AndrewDMerrill
13 - Pulsar

Here is a variant that should work for all test cases:

Screenshot.png

Labels