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

Can I use a loop to segregate data into time periods?

cframos
7 - Meteor

I'm trying to create a workflow to summarize values from several months of data in a fortnight basis, i.e. for every month I need to extract a sum of values from the first and the second half of the month. The final result is a Matrix with the same number of columns as of rows. I was able to do that in Formula for 5 periods (15, 30, 60, 90 and 180 days), but to get the full result I would need to right a formula with 70+ ELSEIFs, so I was looking for a solution to do it iteratively, where I'll have the date in rows and the 15-day periods in columns, Something like that:

 

Due date15306090180 
06/19 - 2º Q636.735900.1618027.0716107.8913982.50 
07/19 - 1º Q806016.6632675.8652986.7341108.4511652.21 
07/19 - 2º Q3755.2946.53503.0636.283920.52 
08/19 - 1º Q30875.708903.767635.31630.61 
08/19 - 2º Q12450.283132.562819.7825.23  
09/19 - 1º Q83724.0723383.5519653.85  
09/19 - 2º Q70917.9515023.946191.93  
10/19 - 1º Q87190.816549.80   
10/19 - 2º Q43045.42     
11/19 - 1º Q4111.53     

 

But, it would be a table with one row for every 15 days (the full dataset will have 5 years of data)

 

Is there a way to do it easily?

Thanks

5 REPLIES 5
BrandonB
Alteryx
Alteryx

Would it be possible to use a Transpose tool to get all of the values from each column into a single column to then use one formula to dynamically run across all of them? It could then be crosstabbed back afterwards. 

danilang
19 - Altair
19 - Altair

hi @cframos 

 

Can you attach AME_Sample.xlsx. 

 

Dan

 

cframos
7 - Meteor

Hi @danilang

There it is

 

 

BrandonB
Alteryx
Alteryx

Does each period range follow this pattern?

0-15 days is 15 days

15-30 days is 15 days

30-60 days is 30 days

60-90 days is 30 days

90-180 days is 90 days

 

Would the next periods be 

180-270 days being 90 days

270-450 days being 180 days

450-630 days being 180 days

 

My initial thought to approach this would be to take [Pay_down_difference_days]/15, drop off the decimal from the result and then multiply by 15 in order to get the closest multiple of 15. The other piece that needs to be determined is how the ranges increase with the higher values. 

cframos
7 - Meteor

Actually, the Pattern is more like:

< 0 (payment before due date) to 15 (payment until 15 days after due date = 1 (reference to first period of 15 days)

16 days to 30 days  = 2 period of 15 days due

31 to 45 = 3

46 to 60 = 4

61 to 75 = 5

...

166 days to 180 days = 12 periods od 15 days

180 to 195 = 13

...

and so on.

 

Since I may have as long as 120 periods (1800 days), it would not be viable to right one line for each period.

 

I'll try to do something like you said, by dividing and dropping the decimals. But it would be great if Alteryx had a way to apply a for loop to do that, as I would do in Python.

 

Labels