<?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: Using a formula column, how do I find a value in a subset of the data based on other columns in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Using-a-formula-column-how-do-I-find-a-value-in-a-subset-of-the/m-p/691070#M87702</link>
    <description>&lt;P&gt;If the signal is very clean, you can just use &lt;FONT face="courier new,courier"&gt;lag&lt;/FONT&gt; to find the jump - otherwise you have to invest more effort to remove noise etc.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Then you just have to subtract the offset of the jump from your original time.&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Col ...&lt;/FONT&gt;&amp;nbsp;aggregations like &lt;FONT face="courier new,courier"&gt;Col Maximum&lt;/FONT&gt; can be used to spread one value to all rows - which then can be subtracted.&lt;/P&gt;&lt;P&gt;A second argument of the &lt;FONT face="courier new,courier"&gt;Col ...&lt;/FONT&gt; aggregation can be used as &lt;EM&gt;GroupBy&lt;/EM&gt;&amp;nbsp;argument (1 maximum per group) to subtract individual offsets for the 2 traces.&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="hogi_1-1698356460779.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/58027i68BD92D56A058152/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_1-1698356460779.png" alt="hogi_1-1698356460779.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;t1 = random integer(1000);
t2 = random integer(1000);

dt = new table("test",
add rows(2000),
New Column( "time",  Set Each value(Mod(row()-1,1000)) ),
New Column( "sample",  Set Each value(floor((row()-1)/1000)+1) ),

New Column( "trace",  Set Each value(if(:time&amp;lt;match(:sample,1,t1,2,t2),1,0 )))
);

New Column( "marker",  Set Each value(if(lag(trace)==1 &amp;amp; :trace==0,time,.)));

New Column( "time_adjusted",
	set each value( :time - Col Maximum( :marker, :sample ) ),
	Set Selected
);

Graph Builder(
	Variables(
		X( :time ),
		X( :time_adjusted ),
		Y( :trace ),
		Group Y( :sample )
	),
	Elements( Position( 1, 1 ), Line( X, Y, Legend( 14 ) ) ),
	Elements( Position( 2, 1 ), Line( X, Y, Legend( 15 ) ) )
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Oct 2023 21:42:44 GMT</pubDate>
    <dc:creator>hogi</dc:creator>
    <dc:date>2023-10-26T21:42:44Z</dc:date>
    <item>
      <title>Using a formula column, how do I find a value in a subset of the data based on other columns</title>
      <link>https://community.jmp.com/t5/Discussions/Using-a-formula-column-how-do-I-find-a-value-in-a-subset-of-the/m-p/691046#M87700</link>
      <description>&lt;P&gt;If I have two different time series in a table, and there is a findable event in both series, but they occur at different times. How can I specify a formula column to subtract off the time such that the finable events start at time zero?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="example.PNG" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/58023i034B7458E154F7EA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="example.PNG" alt="example.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 21:09:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-a-formula-column-how-do-I-find-a-value-in-a-subset-of-the/m-p/691046#M87700</guid>
      <dc:creator>Cactus123456</dc:creator>
      <dc:date>2023-10-26T21:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using a formula column, how do I find a value in a subset of the data based on other columns</title>
      <link>https://community.jmp.com/t5/Discussions/Using-a-formula-column-how-do-I-find-a-value-in-a-subset-of-the/m-p/691070#M87702</link>
      <description>&lt;P&gt;If the signal is very clean, you can just use &lt;FONT face="courier new,courier"&gt;lag&lt;/FONT&gt; to find the jump - otherwise you have to invest more effort to remove noise etc.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Then you just have to subtract the offset of the jump from your original time.&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Col ...&lt;/FONT&gt;&amp;nbsp;aggregations like &lt;FONT face="courier new,courier"&gt;Col Maximum&lt;/FONT&gt; can be used to spread one value to all rows - which then can be subtracted.&lt;/P&gt;&lt;P&gt;A second argument of the &lt;FONT face="courier new,courier"&gt;Col ...&lt;/FONT&gt; aggregation can be used as &lt;EM&gt;GroupBy&lt;/EM&gt;&amp;nbsp;argument (1 maximum per group) to subtract individual offsets for the 2 traces.&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="hogi_1-1698356460779.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/58027i68BD92D56A058152/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_1-1698356460779.png" alt="hogi_1-1698356460779.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;t1 = random integer(1000);
t2 = random integer(1000);

dt = new table("test",
add rows(2000),
New Column( "time",  Set Each value(Mod(row()-1,1000)) ),
New Column( "sample",  Set Each value(floor((row()-1)/1000)+1) ),

New Column( "trace",  Set Each value(if(:time&amp;lt;match(:sample,1,t1,2,t2),1,0 )))
);

New Column( "marker",  Set Each value(if(lag(trace)==1 &amp;amp; :trace==0,time,.)));

New Column( "time_adjusted",
	set each value( :time - Col Maximum( :marker, :sample ) ),
	Set Selected
);

Graph Builder(
	Variables(
		X( :time ),
		X( :time_adjusted ),
		Y( :trace ),
		Group Y( :sample )
	),
	Elements( Position( 1, 1 ), Line( X, Y, Legend( 14 ) ) ),
	Elements( Position( 2, 1 ), Line( X, Y, Legend( 15 ) ) )
)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 21:42:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-a-formula-column-how-do-I-find-a-value-in-a-subset-of-the/m-p/691070#M87702</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2023-10-26T21:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using a formula column, how do I find a value in a subset of the data based on other columns</title>
      <link>https://community.jmp.com/t5/Discussions/Using-a-formula-column-how-do-I-find-a-value-in-a-subset-of-the/m-p/692175#M87789</link>
      <description>&lt;P&gt;This solved my problem exactly!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think col ... aggregations was something I was sorely missing in my mental toolbox.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2023 17:49:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Using-a-formula-column-how-do-I-find-a-value-in-a-subset-of-the/m-p/692175#M87789</guid>
      <dc:creator>Cactus123456</dc:creator>
      <dc:date>2023-10-30T17:49:39Z</dc:date>
    </item>
  </channel>
</rss>

