cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
BHarris
Level VI

Select last point in each run

Suppose I have columns:  run_id, time, distance

 

... and I want to just select the rows with the last time for each run_id.  How do I do that?

1 ACCEPTED SOLUTION

Accepted Solutions
BHarris
Level VI

Re: Select last point in each run

Is this pretty typical in JMP, to create formula columns to look for certain conditions then select based on that?
I played around for a minute after writing this question and ended up with this formula column: Col Maximum ( :Name( "time(s)" ), :run_id ) - :Name( "time(s)" )
... then I just click on one of the rows with "0" and then did a "select matching". I was hoping there was an easier way, like making a summary table with max(time) grouped by run_id, then let me select the rows there, but those rows were selecting all of the data from which the max was calculated, not just the rows that held the max value.

View solution in original post

3 REPLIES 3

Re: Select last point in each run

You can create an indicator column using a formula. Be sure to sort (nested) by run_id and time first. The formula would be a simple Boolean result. Use the Lag() function as such: If( :run_id == Lag( :run_id, -1 ), 0, 1 ). Then you can select the rows where this column equals 1.

BHarris
Level VI

Re: Select last point in each run

Is this pretty typical in JMP, to create formula columns to look for certain conditions then select based on that?
I played around for a minute after writing this question and ended up with this formula column: Col Maximum ( :Name( "time(s)" ), :run_id ) - :Name( "time(s)" )
... then I just click on one of the rows with "0" and then did a "select matching". I was hoping there was an easier way, like making a summary table with max(time) grouped by run_id, then let me select the rows there, but those rows were selecting all of the data from which the max was calculated, not just the rows that held the max value.
txnelson
Super User

Re: Select last point in each run

Just to add something that I hope is obvious to all......for @Mark_Bailey code to work, the data table needs to be sorted ascending on columns run_id and time
Jim