Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
I am looking for a way to flag all rows in a sequence. I have added a small example of the desired output below (column Calculated status) So far no luck using the previous function. Hope anyone can point me in the right direction. Thanks!
ID | Status | Date | Level | Calculated status |
1 | 1 | 01-01-2 | 0 | |
1 | 3 | |||
1 | 0 | |||
1 | 4 | |||
1 | 0 | Stopped | ||
1 | 0 | Stopped | ||
1 | 0 | Stopped | ||
1 | 2 | 0 | Stopped | |
2 | 1 | 4 | ||
2 | 5 | |||
2 | 2 | 0 | Stopped | |
3 | 1 |
Write the following in the script editor to flag the rows where the level = 0:
TableName:
Load
*,
if(Level = 0, 'Stopped') as [Calculated status]
From YourSource;
Hope it helps!
Hi Tim, I failed to illustrate the following in the example.
The calculated status can only be 'Stopped' if the end of the bottom row where status = 2 and level = 0. All above 0 should also become 'stopped' until the first none 0 has been reached.
I have updated my example