<?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: Want to count up when change occurs in either of two data columns in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Want-to-count-up-when-change-occurs-in-either-of-two-data/m-p/222924#M44474</link>
    <description>&lt;P&gt;Oh, Im sorry, I thought I had to sub a column in for x. Nevermind, it works, thank you!!!&lt;/P&gt;</description>
    <pubDate>Fri, 23 Aug 2019 20:00:59 GMT</pubDate>
    <dc:creator>chall</dc:creator>
    <dc:date>2019-08-23T20:00:59Z</dc:date>
    <item>
      <title>Want to count up when change occurs in either of two data columns</title>
      <link>https://community.jmp.com/t5/Discussions/Want-to-count-up-when-change-occurs-in-either-of-two-data/m-p/222881#M44469</link>
      <description>&lt;P&gt;So I have 2 columns of data that have many identical values but which increment at certain points. They are the month and date of data points. Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE border="1"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;STRONG&gt;Month&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;STRONG&gt;Day&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;STRONG&gt;Desired Counter:&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ive tried using lag unsuccessfully as I dont want an increment unless a value changes. I've tried different solutions including:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If(
	Row() == 1, 1,
	Lag( :Month, 1 ) &amp;amp; Lag( :Day, 1 ), Lag( :DesiredCounter, 1 )
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A similar &lt;A href="https://community.jmp.com/t5/Discussions/Count-up/td-p/7535" target="_self"&gt;solution&lt;/A&gt; was posted but didnt work for me as I need to keep both columns into account. Can someone help with this? Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 19:48:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Want-to-count-up-when-change-occurs-in-either-of-two-data/m-p/222881#M44469</guid>
      <dc:creator>chall</dc:creator>
      <dc:date>2019-08-23T19:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: Want to count up when change occurs in either of two data columns</title>
      <link>https://community.jmp.com/t5/Discussions/Want-to-count-up-when-change-occurs-in-either-of-two-data/m-p/222897#M44470</link>
      <description>&lt;P&gt;Here is how I typically do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Row() == 1,
	x = 1,
	If( Lag( :Month ) != :Month | Lag( :day ) != :Day,
		x = x + 1
	)
);
x;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Aug 2019 19:08:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Want-to-count-up-when-change-occurs-in-either-of-two-data/m-p/222897#M44470</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-08-23T19:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: Want to count up when change occurs in either of two data columns</title>
      <link>https://community.jmp.com/t5/Discussions/Want-to-count-up-when-change-occurs-in-either-of-two-data/m-p/222909#M44472</link>
      <description>&lt;P&gt;Hey Jim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply. So I tried this and I'm just getting a bunch of 1's still. Is there anything else I might need to add? X is our desired counting column right? Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 19:39:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Want-to-count-up-when-change-occurs-in-either-of-two-data/m-p/222909#M44472</guid>
      <dc:creator>chall</dc:creator>
      <dc:date>2019-08-23T19:39:22Z</dc:date>
    </item>
    <item>
      <title>Re: Want to count up when change occurs in either of two data columns</title>
      <link>https://community.jmp.com/t5/Discussions/Want-to-count-up-when-change-occurs-in-either-of-two-data/m-p/222923#M44473</link>
      <description>&lt;P&gt;Here is a script that creates your sample data table, and applies the formula to the Desired Counter: column&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Table( "Example",
	Add Rows( 6 ),
	New Column( "Month",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [1, 1, 2, 2, 3, 3] )
	),
	New Column( "Day",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [1, 1, 2, 3, 1, 1] )
	),
	New Column( "Desired Counter:",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula(
			If( Row() == 1,
				x = 1,
				If( Lag( :Month ) != :Month | Lag( :Day ) != :Day,
					x = x + 1
				)
			);
			x;
		)
	)
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It produces this data table:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="counter.PNG" style="width: 427px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/18983i42720A2CF511906A/image-size/large?v=v2&amp;amp;px=999" role="button" title="counter.PNG" alt="counter.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 19:58:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Want-to-count-up-when-change-occurs-in-either-of-two-data/m-p/222923#M44473</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-08-23T19:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: Want to count up when change occurs in either of two data columns</title>
      <link>https://community.jmp.com/t5/Discussions/Want-to-count-up-when-change-occurs-in-either-of-two-data/m-p/222924#M44474</link>
      <description>&lt;P&gt;Oh, Im sorry, I thought I had to sub a column in for x. Nevermind, it works, thank you!!!&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 20:00:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Want-to-count-up-when-change-occurs-in-either-of-two-data/m-p/222924#M44474</guid>
      <dc:creator>chall</dc:creator>
      <dc:date>2019-08-23T20:00:59Z</dc:date>
    </item>
  </channel>
</rss>

