<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Finding first and last elements in a column with a By variable in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Finding-first-and-last-elements-in-a-column-with-a-By-variable/m-p/56193#M31542</link>
    <description>&lt;P&gt;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.&amp;nbsp; Do the same for the minimums.&lt;/P&gt;</description>
    <pubDate>Tue, 01 May 2018 15:52:35 GMT</pubDate>
    <dc:creator>dale_lehman</dc:creator>
    <dc:date>2018-05-01T15:52:35Z</dc:date>
    <item>
      <title>Finding first and last elements in a column with a By variable</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-first-and-last-elements-in-a-column-with-a-By-variable/m-p/56163#M31526</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using &lt;SPAN&gt;Col Maximum(LEVEL, Event.Date) -&amp;nbsp;&lt;/SPAN&gt;Col Minimum(LEVEL, Event.Date) will give the range, but NOT if negative or positive.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please refer to the attached graphic of data table snippet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Data Table Snippet" style="width: 374px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/10587i269EA50A2297439A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Tank Level By Event.PNG" alt="Data Table Snippet" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Data Table Snippet&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 23:33:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-first-and-last-elements-in-a-column-with-a-By-variable/m-p/56163#M31526</guid>
      <dc:creator>markschahl</dc:creator>
      <dc:date>2018-04-30T23:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: Finding first and last elements in a column with a By variable</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-first-and-last-elements-in-a-column-with-a-By-variable/m-p/56193#M31542</link>
      <description>&lt;P&gt;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.&amp;nbsp; Do the same for the minimums.&lt;/P&gt;</description>
      <pubDate>Tue, 01 May 2018 15:52:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-first-and-last-elements-in-a-column-with-a-By-variable/m-p/56193#M31542</guid>
      <dc:creator>dale_lehman</dc:creator>
      <dc:date>2018-05-01T15:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: Finding first and last elements in a column with a By variable</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-first-and-last-elements-in-a-column-with-a-By-variable/m-p/56204#M31549</link>
      <description>&lt;P&gt;Do either of these work for you?&lt;/P&gt;
&lt;P&gt;The first option gives what you asked for (level at end - level at beginning):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Lag( :DayOfEvent, -1 ) == 0,
	:LEVEL - Lag( :LEVEL, :DayOfEvent )
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The second gives that plus what happened in between (current level - level at beginning):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( :DayOfEvent == 0,
	.,
	:LEVEL - Lag( :LEVEL, :DayOfEvent )
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 May 2018 15:05:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-first-and-last-elements-in-a-column-with-a-By-variable/m-p/56204#M31549</guid>
      <dc:creator>jerry_cooper</dc:creator>
      <dc:date>2018-05-02T15:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: Finding first and last elements in a column with a By variable</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-first-and-last-elements-in-a-column-with-a-By-variable/m-p/63510#M34026</link>
      <description>&lt;P&gt;Jerry:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks! That worked!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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...&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 13:25:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-first-and-last-elements-in-a-column-with-a-By-variable/m-p/63510#M34026</guid>
      <dc:creator>markschahl</dc:creator>
      <dc:date>2018-07-20T13:25:02Z</dc:date>
    </item>
  </channel>
</rss>

