<?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: Date Difference calculation referencing grouping columns in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Date-Difference-calculation-referencing-grouping-columns/m-p/268043#M52185</link>
    <description>&lt;P&gt;Here is the formula that I would use for the calculation&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Row() == 1 | :ID != Lag( :ID ),
	lastCmtDate = .
);
If( :Comments != "",
	lastCmtDate = :Sampled Date
);
:Days Since Last Comment = (:Sampled Date - lastCmtDate) / In Days( 1 );&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 20 May 2020 19:17:43 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2020-05-20T19:17:43Z</dc:date>
    <item>
      <title>Date Difference calculation referencing grouping columns</title>
      <link>https://community.jmp.com/t5/Discussions/Date-Difference-calculation-referencing-grouping-columns/m-p/267998#M52169</link>
      <description>&lt;P&gt;I am trying to calculate a Date Difference in Days between the current row and the last row where a comment is non-missing. Any help greatly appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( (:ID == Lag( :ID ) | Row() == 1) &amp;amp; !Is Missing( :Comments ), 0,
Date Difference( :Sampled Date, Lag(:Sampled Date, &lt;FONT color="#FF0000"&gt;n=last row where !Is Missing(:Comments)&lt;/FONT&gt;), "Day" )
)&lt;/CODE&gt;&lt;/PRE&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="ktbrickey_0-1589984249701.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/24101iEFA45D14CFFC0B2D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ktbrickey_0-1589984249701.png" alt="ktbrickey_0-1589984249701.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2020 14:26:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-Difference-calculation-referencing-grouping-columns/m-p/267998#M52169</guid>
      <dc:creator>ktbrickey</dc:creator>
      <dc:date>2020-05-20T14:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: Date Difference calculation referencing grouping columns</title>
      <link>https://community.jmp.com/t5/Discussions/Date-Difference-calculation-referencing-grouping-columns/m-p/268039#M52183</link>
      <description>&lt;P&gt;If the table is always sorted by date you could do this with two columns, as shown below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Column( "Last Comment Date",
	Numeric,
	"Continuous",
	Format( "m/d/y h:m", 19 ),
	Input Format( "Monddyyyy h:m" ),
	Formula(
		If(
			Row() == 1, :Sampled Date,
			:Comments == Lag( :Comments, 1 ), Lag( :Sampled Date, 1 ),
			:Sampled Date
		)
	),
	Set Display Width( 136 )
);
New Column( "Days Since Last Comment New",
	Numeric,
	"Continuous",
	Format( "Best", 12 ),
	Formula( (:Sampled Date - :Last Comment Date) / (3600 * 24) ),
	Set Display Width( 109 )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 May 2020 18:48:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-Difference-calculation-referencing-grouping-columns/m-p/268039#M52183</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2020-05-20T18:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: Date Difference calculation referencing grouping columns</title>
      <link>https://community.jmp.com/t5/Discussions/Date-Difference-calculation-referencing-grouping-columns/m-p/268043#M52185</link>
      <description>&lt;P&gt;Here is the formula that I would use for the calculation&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Row() == 1 | :ID != Lag( :ID ),
	lastCmtDate = .
);
If( :Comments != "",
	lastCmtDate = :Sampled Date
);
:Days Since Last Comment = (:Sampled Date - lastCmtDate) / In Days( 1 );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 May 2020 19:17:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-Difference-calculation-referencing-grouping-columns/m-p/268043#M52185</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-05-20T19:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: Date Difference calculation referencing grouping columns</title>
      <link>https://community.jmp.com/t5/Discussions/Date-Difference-calculation-referencing-grouping-columns/m-p/268315#M52244</link>
      <description>&lt;P&gt;Thanks ih, but this doesn't work. The new column you created is not populated with the date of the last comment, just the lag sampled date. Thanks for trying!&lt;/P&gt;</description>
      <pubDate>Fri, 22 May 2020 12:12:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-Difference-calculation-referencing-grouping-columns/m-p/268315#M52244</guid>
      <dc:creator>ktbrickey</dc:creator>
      <dc:date>2020-05-22T12:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: Date Difference calculation referencing grouping columns</title>
      <link>https://community.jmp.com/t5/Discussions/Date-Difference-calculation-referencing-grouping-columns/m-p/268316#M52245</link>
      <description>&lt;P&gt;Thank you! This worked!&lt;/P&gt;</description>
      <pubDate>Fri, 22 May 2020 12:14:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-Difference-calculation-referencing-grouping-columns/m-p/268316#M52245</guid>
      <dc:creator>ktbrickey</dc:creator>
      <dc:date>2020-05-22T12:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: Date Difference calculation referencing grouping columns</title>
      <link>https://community.jmp.com/t5/Discussions/Date-Difference-calculation-referencing-grouping-columns/m-p/724487#M90702</link>
      <description>&lt;P&gt;I think I have a very simular problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the formula you give us, but in my table it don't work. (column 5&amp;nbsp;(Differenz in Tagen Bauteil 1)).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At first it is write the day difference not in the rows wear the comment (1) is,&amp;nbsp;rather in all other rows.&lt;/P&gt;&lt;P&gt;And more important for me, it's write just the difference to the last date, and not to the date where the last comment (or no comment) was.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help, again?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2024 08:54:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-Difference-calculation-referencing-grouping-columns/m-p/724487#M90702</guid>
      <dc:creator>voy-voy</dc:creator>
      <dc:date>2024-02-16T08:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Date Difference calculation referencing grouping columns</title>
      <link>https://community.jmp.com/t5/Discussions/Date-Difference-calculation-referencing-grouping-columns/m-p/724502#M90706</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Row() == 1 | :Source Table != Lag( :Source Table ),
	lastCmtDate = :"Datum:"n,
	lastCmtDate = Lag( :"Datum:"n )
);
If( :Bauteil 1 == "",
	:Differenz in Tagen Bauteil 1 = (:"Datum:"n - lastCmtDate) / In Days( 1 ),
	:Differenz in Tagen Bauteil 1 = .
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Feb 2024 11:59:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-Difference-calculation-referencing-grouping-columns/m-p/724502#M90706</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-02-16T11:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: Date Difference calculation referencing grouping columns</title>
      <link>https://community.jmp.com/t5/Discussions/Date-Difference-calculation-referencing-grouping-columns/m-p/725046#M90902</link>
      <description>&lt;P&gt;Thank you Jim.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is still not work, bu with your formulars I have found now a Work around and use 2 new colums to calculated and now it works :)&lt;/img&gt;&lt;/P&gt;&lt;PRE&gt;New Column( "Letzter Komentar Tag",&lt;BR /&gt;Numerisch,&lt;BR /&gt;"Stetig",&lt;BR /&gt;Format( "t.m.j", 12 ),&lt;BR /&gt;Eingabeformat( "t.m.j" ),&lt;BR /&gt;Formel(&lt;BR /&gt;If( Row() == 1 | :Quelltabelle != Lag( :Quelltabelle ),&lt;BR /&gt;lastCmtDate = .&lt;BR /&gt;);&lt;BR /&gt;If( :Bauteil 1 == "1",&lt;BR /&gt;lastCmtDate = :"Datum:"n,&lt;BR /&gt;lastCmtDate&lt;BR /&gt;)));&lt;BR /&gt;&lt;BR /&gt;New Column( "Differenz Bauteil 1",&lt;BR /&gt;Numerisch,&lt;BR /&gt;"Stetig",&lt;BR /&gt;Format( "Bestes", 12 ),&lt;BR /&gt;Formel(&lt;BR /&gt;If( :Bauteil 1 == "1",&lt;BR /&gt;(:"Datum:"n - Lag( :Letzter Komentar Tag )) / In Days( 1 )&lt;BR /&gt;)));&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Feb 2024 10:56:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-Difference-calculation-referencing-grouping-columns/m-p/725046#M90902</guid>
      <dc:creator>voy-voy</dc:creator>
      <dc:date>2024-02-22T10:56:50Z</dc:date>
    </item>
  </channel>
</rss>

