cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Due to the recently reported Microsoft outage, users may be temporarily unable to access My JMP or experience a delay receiving their verification codes. If you have previously installed JMP on your computer, this outage should not impact your ability to access the software. My JMP services will be restored as soon as Microsoft resolves this issue.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
markschahl
Level VI

Finding first and last elements in a column with a By variable

Hi!

 

I'm investigating what happened to continous variable (tank level in this case) during certain events. I have an Event.Date column that acts as a By variable. Event duration varies, see DayOfEvent column. I want to calculate: LEVEL @ end of event - LEVEL @ beginning of event, i.e. last element - first element by Event.Date. If positive, tank was filled, if negative tank was emptied, if ~0 tank was not used.

 

Using Col Maximum(LEVEL, Event.Date) - Col Minimum(LEVEL, Event.Date) will give the range, but NOT if negative or positive.

 

Please refer to the attached graphic of data table snippet.

 

Thanks!
Data Table SnippetData Table Snippet

 

1 ACCEPTED SOLUTION

Accepted Solutions
jerry_cooper
Staff (Retired)

Re: Finding first and last elements in a column with a By variable

Do either of these work for you?

The first option gives what you asked for (level at end - level at beginning):

If( Lag( :DayOfEvent, -1 ) == 0,
	:LEVEL - Lag( :LEVEL, :DayOfEvent )
)

The second gives that plus what happened in between (current level - level at beginning):

If( :DayOfEvent == 0,
	.,
	:LEVEL - Lag( :LEVEL, :DayOfEvent )
)

View solution in original post

3 REPLIES 3
dale_lehman
Level VII

Re: Finding first and last elements in a column with a By variable

How about using col maximum of event date, by day of event and then creating a column that uses the level if those dates match.  Do the same for the minimums.

jerry_cooper
Staff (Retired)

Re: Finding first and last elements in a column with a By variable

Do either of these work for you?

The first option gives what you asked for (level at end - level at beginning):

If( Lag( :DayOfEvent, -1 ) == 0,
	:LEVEL - Lag( :LEVEL, :DayOfEvent )
)

The second gives that plus what happened in between (current level - level at beginning):

If( :DayOfEvent == 0,
	.,
	:LEVEL - Lag( :LEVEL, :DayOfEvent )
)
markschahl
Level VI

Re: Finding first and last elements in a column with a By variable

Jerry:

 

Thanks! That worked!

 

Applogies for the delay. Almost three months of travel, including training 100+ engineers at five sites globally how to use JMP, delayed my response. It's been just a bit busy...

Recommended Articles