| Person_ID | Visit_ID | DX1 | DX2 | DX3 | DX4 |
1 | 1 | 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 1 | 0 | 0 |
| 1 | 1 | 0 | 0 | 0 | 1 |
| 1 | 1 | 0 | 0 | 1 | 0 |
| 1 | 2 | 1 | 0 | 0 | 0 |
| 2 | 3 | 1 | 0 | 0 | 0 |
| 2 | 3 | 0 | 0 | 1 | 0 |
| 3 | 4 | 0 | 1 | 0 | 0 |
| 4 | 5 | 1 | 0 | 0 | 0 |
Hello, I am trying to create a dataset that only has one row per visit id. Currently, my data is structured as above, where each row contains a diagnosis indicator for each visit. What I would like is to have one row for each visit with all the dx. So it would look like this:
| Person_ID | Visit_ID | DX1 | DX2 | DX3 | DX4 |
| 1 | 1 | 1 | 1 | 1 | 1 |
| 1 | 2 | 1 | 0 | 0 | 0 |
| 2 | 3 | 1 | 0 | 1 | 0 |
| 3 | 4 | 0 | 1 | 0 | 0 |
| 4 | 5 | 1 | 0 | 0 | 0 |
I am new to alteryx and not sure what the best way to do this would be? I looked at the multi-row function, but I want to look at more than a constant n row/s above or below.
Thanks
Cait