<?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: Adjustable Lag Difference? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Adjustable-Lag-Difference/m-p/628237#M82657</link>
    <description>&lt;P&gt;Easiest way (in my opinion) to see how it works is to divide that formula into three different formulas&lt;/P&gt;
&lt;P&gt;First one (BatchMinRow)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Col Min(Row(), :Batch)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Second using the just created BatchMinRow (BatchMinVal)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;:Result[:BatchMinRow]&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and finally third one&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;:Result - :BatchMinVal&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;this makes it much easier to see what the different parts in the formula do&lt;/P&gt;</description>
    <pubDate>Wed, 03 May 2023 16:22:22 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2023-05-03T16:22:22Z</dc:date>
    <item>
      <title>Adjustable Lag Difference?</title>
      <link>https://community.jmp.com/t5/Discussions/Adjustable-Lag-Difference/m-p/628207#M82654</link>
      <description>&lt;P&gt;Don't know how to title this but here goes. I have data sets with several time points per batch. For each batch I want to calculate the difference in results from time point zero. I used to compare each result to column min or max (as suitable) which worked fine, but when results are a bit jumpy, the max or min may happen at another time point than zero.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want the (desired) diff as below. Is there a simple way to do this in a formula?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ake_0-1683127236504.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/52527i61243B9B9175A74B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ake_0-1683127236504.png" alt="Ake_0-1683127236504.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;jmp 17.1&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 00:00:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adjustable-Lag-Difference/m-p/628207#M82654</guid>
      <dc:creator>Ake</dc:creator>
      <dc:date>2023-06-11T00:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: Adjustable Lag Difference?</title>
      <link>https://community.jmp.com/t5/Discussions/Adjustable-Lag-Difference/m-p/628220#M82655</link>
      <description>&lt;P&gt;If the results are ordered, you could use something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;:Result - :Result[Col Min(Row(), :Batch)]&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Col Min(Row(), :Batch) will get the first row for specific batch and then we can access that row by using :Result[rownr].&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1683129377019.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/52529iCEB18B68495316F3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1683129377019.png" alt="jthi_0-1683129377019.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;If the data isn't always ordered it isn't really a problem, but it will require different formula&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 15:56:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adjustable-Lag-Difference/m-p/628220#M82655</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-05-03T15:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: Adjustable Lag Difference?</title>
      <link>https://community.jmp.com/t5/Discussions/Adjustable-Lag-Difference/m-p/628236#M82656</link>
      <description>&lt;P&gt;Thanks for extremely fast, and useful, response! I will ponder how, but I see it works!&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 16:18:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adjustable-Lag-Difference/m-p/628236#M82656</guid>
      <dc:creator>Ake</dc:creator>
      <dc:date>2023-05-03T16:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: Adjustable Lag Difference?</title>
      <link>https://community.jmp.com/t5/Discussions/Adjustable-Lag-Difference/m-p/628237#M82657</link>
      <description>&lt;P&gt;Easiest way (in my opinion) to see how it works is to divide that formula into three different formulas&lt;/P&gt;
&lt;P&gt;First one (BatchMinRow)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Col Min(Row(), :Batch)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Second using the just created BatchMinRow (BatchMinVal)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;:Result[:BatchMinRow]&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and finally third one&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;:Result - :BatchMinVal&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;this makes it much easier to see what the different parts in the formula do&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 16:22:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adjustable-Lag-Difference/m-p/628237#M82657</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-05-03T16:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Adjustable Lag Difference?</title>
      <link>https://community.jmp.com/t5/Discussions/Adjustable-Lag-Difference/m-p/628238#M82658</link>
      <description>&lt;P&gt;Just adding few possible options if the data isn't always sorted.&lt;/P&gt;
&lt;P&gt;Using matrix calculations to get the indices&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;As Constant(
	times = :Time &amp;lt;&amp;lt; get as matrix;
	batches = :Batch &amp;lt;&amp;lt; get as matrix;
);

batch_rows = Loc(batches, :Batch);
batch_first_time_row = batch_rows[Loc Min(times[batch_rows])];
:Result - :Result[batch_first_time_row];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and using Col Sum to get the minimum value with comparison and product (if :Time isn't the smallest multiplier is 0). &lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;:Result - Col Sum((:Time == Col Min(:Time, :Batch)) * :Result, :Batch);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 16:26:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Adjustable-Lag-Difference/m-p/628238#M82658</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-05-03T16:26:33Z</dc:date>
    </item>
  </channel>
</rss>

