I have tiled my data based on a particular field and sequenced the cases within the tile in ascending order. I want to create a new variable that picks the case with the maximum value (or last occurring) and mark it for further process. See example table below. Suggestions?
RecID | PID (Tiled) | Visit Seq | New Var. |
1 |
1 |
1 | |
2 | 1 | 2 | |
3 | 1 | 3 | Flag |
4 | 2 | 1 | |
5 | 2 | 2 | |
6 | 2 | 3 | Flag |
7 | 3 | 1 | |
8 | 3 | 2 | |
9 | 3 | 3 | Flag |
Solved! Go to Solution.
As with all things Alteryx, there are a number of ways to do this.
One (assuming that your data is in the order shown...which you can ensure by sorting first) would be to use a Multi-Row formula that inserts your flag when the PID changes in the next record.
Another way would be to use the Summarize tool, group by the PID, and use the Max function. This would give you a separate set of results that you could join back to the original workflow and then use that as the basis for the flag.
I'd probably use the first alternative myself.
Thanks - very helpful!! Two solutions are better than one! - Rad