<?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: How to Count rows based on difference between values in a column ? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-Count-rows-based-on-difference-between-values-in-a-column/m-p/802896#M97958</link>
    <description>&lt;P&gt;Here is the formula I came up with&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If(
	Row() == 1, count = 1,
	:DieY - Lag( :DieY ) &amp;gt; 5, count
	++);
count;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1727770895361.png" style="width: 804px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68742i8DBF7E42939E01E9/image-dimensions/804x547?v=v2" width="804" height="547" role="button" title="txnelson_0-1727770895361.png" alt="txnelson_0-1727770895361.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 01 Oct 2024 08:21:58 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2024-10-01T08:21:58Z</dc:date>
    <item>
      <title>How to Count rows based on difference between values in a column ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-Count-rows-based-on-difference-between-values-in-a-column/m-p/802838#M97951</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to create a new column based on column "DieY"&lt;/P&gt;&lt;P&gt;I want continuous count based on the difference between each row and the previous one.&lt;/P&gt;&lt;P&gt;row 2-row 1, row 3-row 2, row 4-row 3 and so on.&lt;/P&gt;&lt;P&gt;if the difference is below a certain value, e.g. 5, set the value to 1.&lt;/P&gt;&lt;P&gt;if the difference is above, add 1 to the count.&lt;/P&gt;&lt;P&gt;keep the last count until the difference is above the value set in the formula.&lt;/P&gt;&lt;P&gt;so eventually I will have a new column with values such as: 1,1,1,1,1,1,1,2,2,2,2,2,2,2,3,3,3,3,3,3,3 and so on..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks to any help&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="Ohad_s_0-1727735727384.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68738i53F6878635D6D028/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ohad_s_0-1727735727384.png" alt="Ohad_s_0-1727735727384.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2024 04:33:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-Count-rows-based-on-difference-between-values-in-a-column/m-p/802838#M97951</guid>
      <dc:creator>Ohad_s</dc:creator>
      <dc:date>2024-10-01T04:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to Count rows based on difference between values in a column ?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-Count-rows-based-on-difference-between-values-in-a-column/m-p/802896#M97958</link>
      <description>&lt;P&gt;Here is the formula I came up with&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If(
	Row() == 1, count = 1,
	:DieY - Lag( :DieY ) &amp;gt; 5, count
	++);
count;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1727770895361.png" style="width: 804px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68742i8DBF7E42939E01E9/image-dimensions/804x547?v=v2" width="804" height="547" role="button" title="txnelson_0-1727770895361.png" alt="txnelson_0-1727770895361.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2024 08:21:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-Count-rows-based-on-difference-between-values-in-a-column/m-p/802896#M97958</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-10-01T08:21:58Z</dc:date>
    </item>
  </channel>
</rss>

