Advent of Code is now back for a limited time only! Complete as many challenges as you can to earn those badges you may have missed in December. Learn more about how to participate here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Indexing Rows Based on Specific Values

Avail
6 - Meteoroid

Hello!

I am trying to write an If statement using the multi-row formula tool to index rows together given specific values. I am indexing based off a 30-Day Claim Period. If the Claim Period is <= 30 days then that is one index. If the difference between one claim period and another is > 30 days then that is a new index.

In the attached image, you will see the difference in claim periods which shows a break in indexes from Index 1 to Index 2. Since the difference in claim periods for records the bottom two records is < 30 they should be grouped together. 

I can't upload an image so I will post the data via text below. Thank you!

 

Case Request TS (Date) | Claim Period | Claim Period Difference | Claim Period minus Difference | Incorrect Index | Correct Index |
          2023-05-31                                   0                                  0                                                                  0                                                      1                                     1
          2023-05-31                                   0                                  0                                                                  0                                                      1                                     1
          2023-05-31                                   0                                  0                                                                  0                                                      1                                     1
          2023-05-31                                   0                                  0                                                                  0                                                      1                                     1
          2023-05-31                                   0                                  0                                                                  0                                                      1                                     1
          2023-05-31                                   0                                  0                                                                  0                                                      1                                     1
          2023-05-31                                   0                                  0                                                                  0                                                      1                                     1
          2023-05-31                                   0                                  0                                                                  0                                                      1                                     1
          2023-06-09                                   9                                  9                                                                  0                                                      1                                     1
          2023-07-15                                  36                                27                                                               9                                                      2                                     2
          2023-08-07                                  23                                13                                                              10                                                    4                                     2

3 REPLIES 3
Avail
6 - Meteoroid

I can't post a picture via my work laptop so I will do my best to explain my dataset with text...Apologies...


Case Request TS (Date) | Claim Period | Claim Period Difference | Claim Period minus Difference | Incorrect Index | Correct Index
       2023-05-31                                0                                  0                                                                          0                                                    1                       1
       2023-05-31                                0                                  0                                                                          0                                                    1                       1
       2023-05-31                                0                                  0                                                                          0                                                    1                       1
       2023-05-31                                0                                  0                                                                          0                                                    1                       1
       2023-05-31                                0                                  0                                                                          0                                                    1                       1
       2023-05-31                                0                                  0                                                                          0                                                    1                       1
       2023-05-31                                0                                  0                                                                          0                                                    1                       1
       2023-05-31                                0                                  0                                                                          0                                                    1                       1
       2023-06-09                                9                                  9                                                                          0                                                    1                       1 
       2023-07-15                               36                                27                                                                       9                                                    2                       2
       2023-08-07                               23                                13                                                                      10                                                   4                       2

Carolyn
12 - Quasar
12 - Quasar

Without being able to see the data - I would do a Sort By Date and then use the Multi-Row Formula to say "If DateTimeDiff([Field1], [Row-1:Field1], 'days') <= 30 then [Row-1:Index] else [Row-1:Index] + 1 endif"

 

2024-07-29_12-00-16.png

Avail
6 - Meteoroid

I just uploaded the data via text (cant upload an image/workflow unfortunately). I will try your first suggestion. Thank you for your help!

Labels
Top Solution Authors