<?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: Counting Formulas in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Counting-Formulas/m-p/804806#M98259</link>
    <description>&lt;P&gt;Is something like this what you are looking for?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Down"&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Col Cumulative Sum(Row() == Col Min(Row(), :Lot))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;"Up"&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Col Sum(Row() == Col Min(Row(), :Lot)) - Col Cumulative Sum(Row() == Col Min(Row(), :Lot)) + 1&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Middle&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Col Cumulative Sum(Row() == Col Min(Row(), :Lot)) - Col Sum(Row() == Col Min(Row(), :Lot)) + 1&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 10 Oct 2024 15:37:17 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-10-10T15:37:17Z</dc:date>
    <item>
      <title>Counting Formulas</title>
      <link>https://community.jmp.com/t5/Discussions/Counting-Formulas/m-p/804795#M98258</link>
      <description>&lt;P&gt;Looking to create 3 cols by col variable to could down with change, count up and count up/down from mid point.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 15:24:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Counting-Formulas/m-p/804795#M98258</guid>
      <dc:creator>DELANDJ1985</dc:creator>
      <dc:date>2024-10-10T15:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Counting Formulas</title>
      <link>https://community.jmp.com/t5/Discussions/Counting-Formulas/m-p/804806#M98259</link>
      <description>&lt;P&gt;Is something like this what you are looking for?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Down"&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Col Cumulative Sum(Row() == Col Min(Row(), :Lot))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;"Up"&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Col Sum(Row() == Col Min(Row(), :Lot)) - Col Cumulative Sum(Row() == Col Min(Row(), :Lot)) + 1&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Middle&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Col Cumulative Sum(Row() == Col Min(Row(), :Lot)) - Col Sum(Row() == Col Min(Row(), :Lot)) + 1&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Oct 2024 15:37:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Counting-Formulas/m-p/804806#M98259</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-10-10T15:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Counting Formulas</title>
      <link>https://community.jmp.com/t5/Discussions/Counting-Formulas/m-p/804874#M98266</link>
      <description>&lt;P&gt;Jarmo's response is the correct answer, if the Lots are always contiguous.&amp;nbsp; &amp;nbsp;However, if the grouping column is not contiguous, such as&lt;/P&gt;
&lt;PRE&gt;A
A
A
B
B
A
A
C
C
C&lt;/PRE&gt;
&lt;P&gt;then the provided formulas will not be correct.&amp;nbsp; Here are alternative formulas that handle noncontiguous groupings&lt;/P&gt;
&lt;P&gt;Down&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;As Constant( count = 0 );
If( :Lot != Lag( :Lot ),
	count
	++);
count;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Up&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;As Constant(
	count = 0;
	For Each Row( If( :Lot != Lag( :Lot ), count++ ) );
	count = count + 1;
);
If( :Lot != Lag( :Lot ),
	count
	--);
count;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Middle&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;As Constant(
	count = 0;
	For Each Row( If( :Lot != Lag( :Lot ), count++ ) );
	count = count + 1;
	count = -1 * Ceiling( count / 2 );
);
If( :Lot != Lag( :Lot ),
	count
	++);
count;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Oct 2024 16:47:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Counting-Formulas/m-p/804874#M98266</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-10-10T16:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: Counting Formulas</title>
      <link>https://community.jmp.com/t5/Discussions/Counting-Formulas/m-p/804887#M98269</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/35817"&gt;@DELANDJ1985&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I had a slightly different take on how to do it than&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;. See the attached jmp file where I defined separate column formulas for each counting scheme. I did each one slightly differently so you could take the concept and perhaps modify it to your specific issue at hand. There might even be more than one possible answer to your query!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; You don't have to make a column formula, but could script it up and run it as a script so the column isn't locked. But, that detail depends on the needs of your specific scenario.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!,&lt;/P&gt;
&lt;P&gt;DS&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 17:31:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Counting-Formulas/m-p/804887#M98269</guid>
      <dc:creator>SDF1</dc:creator>
      <dc:date>2024-10-10T17:31:31Z</dc:date>
    </item>
  </channel>
</rss>

