Hi,
I want to know if I can collapse dates?
Input
MEMBER | COVERAGE PERIOD |
M1 | 5/1/2015 |
M1 | 6/1/2015 |
M1 | 7/1/2015 |
M1 | 8/1/2015 |
M1 | 9/1/2015 |
M1 | 10/1/2015 |
M1 | 11/1/2015 |
M1 | 3/1/2016 |
Output
MEMBER | START SERVICE | STOP SERVICE |
M1 | 5/1/2015 | 12/1/2015 |
M1 | 3/1/2016 | 4/1/2016 |
I don't want to use the Min and Max as it will not give the break downs in the periods. Can the above output be achieved?
Solved! Go to Solution.
As with everything in Alteryx, multiple approaches are possible. Here's mine.
if isnull([STOP SERVICE]) then DateTimeadd([START SERVICE],1,"months") else [STOP SERVICE] ENDIF
Test it out, examine the outputs at various steps, make sure it's doing what you want. I tested it with success on your dataset, then I expanded your dataset, adding other members, and other months, all out of sequence. Output seemed correct to me.
Thanks @Storm. Your solution is excellent.
I am kinda having trouble with the "STOP" function..See attached excel sheet. I am guessing it has to do with way to sort but I tried to my level best..and still couldn't get the o/p. Any help on this is greatly appreciated!!
Not all records are of same scenario. The logic works where the where the row-1 record date is greater than the row date (example "transfer to" rows from the i/p file) but there are some records where the row-1 record date is less than the row date (transfer from rows from the i/p file).. Can we include both the scenarios in the logic?
I kinda played around and found the solution