Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Additional thought to my previous post. Taking a different approach.
I want to add a new key to each row in my data. But I want the value to start at 1 each time the ID changes in the data.
For example:
ID Key
1 1
2 1
2 2
2 3
3 1
I'm close. But just can't quite get it to work.
This should work for you:
Data:
LOAD * INLINE [
ID
1
2
2
2
3
];
Data_Final:
LOAD ID,
IF(Previous(ID) = ID, Peek(Key) + 1, 1) AS Key
RESIDENT Data
ORDER BY ID;
This should work for you:
Data:
LOAD * INLINE [
ID
1
2
2
2
3
];
Data_Final:
LOAD ID,
IF(Previous(ID) = ID, Peek(Key) + 1, 1) AS Key
RESIDENT Data
ORDER BY ID;