<?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: Finding the maximum of a column by matching another column condition in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/304895#M56111</link>
    <description>Thanks, Jim&lt;BR /&gt;it is finding the value but for some reason does not show up in the column. THE current PMA Counter is all blank</description>
    <pubDate>Thu, 10 Sep 2020 21:16:56 GMT</pubDate>
    <dc:creator>Mikasa</dc:creator>
    <dc:date>2020-09-10T21:16:56Z</dc:date>
    <item>
      <title>Finding the maximum of a column by matching another column condition</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/304707#M56095</link>
      <description>&lt;P&gt;Hi every one,&lt;/P&gt;&lt;P&gt;I have to find the maximum value in a column (:PMA Counter) after checking the condition in another column (: Condition). the condition column has "After" and "Before" characters for the different rows.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to pick those which are "After" and fin the maximum of (:PMA Counter) between them.&amp;nbsp; I already use the below script but it is not working and only give me the Max without considering the Condition column.&lt;/P&gt;&lt;P&gt;dt=Current table();&lt;/P&gt;&lt;P&gt;dt&amp;lt;&amp;lt;Select Where(Contains (:Condition ,"After" ));&lt;BR /&gt;dt&amp;lt;&amp;lt;New Column ("Current PMA Counter", Character,Nominal, Formula(Col Max(:PMA Counter)));&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 23:37:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/304707#M56095</guid>
      <dc:creator>Mikasa</dc:creator>
      <dc:date>2023-06-09T23:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the maximum of a column by matching another column condition</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/304728#M56096</link>
      <description>&lt;P&gt;The row Select is not honored by the formula.&amp;nbsp; Here is a way to handle what you need&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; New Column( "Current PMA Counter",
	Character,
	Nominal,
	Formula( Col Max( If( Contains( :Condition, "After" ), :PMA Counter, . ) ) )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Sep 2020 17:20:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/304728#M56096</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-09-10T17:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the maximum of a column by matching another column condition</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/304738#M56099</link>
      <description>Thank you very much Jim :)&lt;/img&gt;</description>
      <pubDate>Thu, 10 Sep 2020 17:31:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/304738#M56099</guid>
      <dc:creator>Mikasa</dc:creator>
      <dc:date>2020-09-10T17:31:40Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the maximum of a column by matching another column condition</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/304739#M56100</link>
      <description>Can I have the Maximum only in the rows related to "After" rows?</description>
      <pubDate>Thu, 10 Sep 2020 17:33:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/304739#M56100</guid>
      <dc:creator>Mikasa</dc:creator>
      <dc:date>2020-09-10T17:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the maximum of a column by matching another column condition</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/304766#M56103</link>
      <description>I do not understand what you are asking for.</description>
      <pubDate>Thu, 10 Sep 2020 18:17:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/304766#M56103</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-09-10T18:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the maximum of a column by matching another column condition</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/304826#M56105</link>
      <description>I meant only those rows that had "After" in the Condition column get the Max value in the Current PMA Counter column. Other rows remain blank.</description>
      <pubDate>Thu, 10 Sep 2020 19:42:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/304826#M56105</guid>
      <dc:creator>Mikasa</dc:creator>
      <dc:date>2020-09-10T19:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the maximum of a column by matching another column condition</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/304830#M56106</link>
      <description>&lt;P&gt;Here are a couple of versions of the formula(They are not tested).&amp;nbsp; They differ in what the Col Max is based on&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// formula where col max is based upon only rows with "After" in PMA Counter
// and the Col Max only appears in rows where PMA Counter has "After" in it
dt &amp;lt;&amp;lt; New Column( "Current PMA Counter",
	Character,
	Nominal,
	Formula(
		If( Row() == 1,
			x = Col Max( If( Contains( :Condition, "After" ), :PMA Counter, . ) )
		);
		If( Contains( :Condition, "After" ),
			y = x,
			y = .
		);
		y;
	)
);

// formula where col max is based upon all rows
// and the Col Max only appears in rows where PMA Counter has "After" in it
dt &amp;lt;&amp;lt; New Column( "Current PMA Counter",
	Character,
	Nominal,
	Formula(
		If( Row() == 1,
			x = Col Max( :PMA Counter )
		);
		If( Contains( :Condition, "After" ),
			y = x,
			y = .
		);
		y;
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Sep 2020 20:06:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/304830#M56106</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-09-10T20:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the maximum of a column by matching another column condition</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/304895#M56111</link>
      <description>Thanks, Jim&lt;BR /&gt;it is finding the value but for some reason does not show up in the column. THE current PMA Counter is all blank</description>
      <pubDate>Thu, 10 Sep 2020 21:16:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/304895#M56111</guid>
      <dc:creator>Mikasa</dc:creator>
      <dc:date>2020-09-10T21:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the maximum of a column by matching another column condition</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/304902#M56114</link>
      <description>can you attach a sample data table that you are applying this to?</description>
      <pubDate>Thu, 10 Sep 2020 21:36:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/304902#M56114</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-09-10T21:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the maximum of a column by matching another column condition</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/305231#M56133</link>
      <description>&lt;P&gt;You can see the data attached.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Sep 2020 15:19:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/305231#M56133</guid>
      <dc:creator>Mikasa</dc:creator>
      <dc:date>2020-09-11T15:19:57Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the maximum of a column by matching another column condition</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/305251#M56135</link>
      <description>&lt;P&gt;I mistakenly created the Current PMA Counter column as a character string, and it needed to be numeric.....the JSL below seems to work&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt=current data table();
dt &amp;lt;&amp;lt; New Column( "Current PMA Counter",
	Formula(
		If( Row() == 1,
			x = Col Max( If( Contains( :Condition, "After" ), :PMA Counter, . ) )
		);
		If( Contains( :Condition, "After" ),
			y = x,
			y = .
		);
		y;
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Sep 2020 16:02:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/305251#M56135</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-09-11T16:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the maximum of a column by matching another column condition</title>
      <link>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/305252#M56136</link>
      <description>Great solution&lt;BR /&gt;Thanks:)</description>
      <pubDate>Fri, 11 Sep 2020 16:09:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Finding-the-maximum-of-a-column-by-matching-another-column/m-p/305252#M56136</guid>
      <dc:creator>Mikasa</dc:creator>
      <dc:date>2020-09-11T16:09:44Z</dc:date>
    </item>
  </channel>
</rss>

