Feb 13, 2020 11:20 AM
| Last Modified: Feb 13, 2020 11:26 AM(986 views)
I'm trying to setup an index that enumerates by a group or set of rows. I've attached a picture to try to explain better what I'm trying to achieve.
As you can see on the picture I'm trying to get the index to be based on the group of steps. The difficulty here or what I'm finding difficult is that the number of instances each step is mentioned for each group can vary and there are gaps where none are listed.
This is what I've used to get me as far as getting the results shown in :Achieved_Index but what I'm really looking for is results like in :Expected_Index
dt = Data Table("sample");
dt << New Column( "Achieved_Index", Numeric( ) );
x = 1;
For Each Row( If( :StepName == "",
:Achieved_Index = 0,
If( Lag(:StepName, -1) != "" | :StepName == "STEP3",
:Achieved_Index = x,
x = x + 1
The ultimate goal is to get that index column working correctly. Than using it to setup the flag column to identify the half-way mark or the last step for each group if there are only two instance. I haven't really thought much on this one besides possibly getting the count of each step for each index, dividing by 2 than using this value for my Lag( ) function. Any suggestions on this would also be appreciated thank you!