<?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: Formula column where all row values are a certain column value matching another column in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Formula-column-where-all-row-values-are-a-certain-column-value/m-p/489013#M73242</link>
    <description>&lt;P&gt;As no example data table (images won't really work as data tables), I wrote smaller table to use as an example.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1653050446711.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/42606i2E76B3B0A0D59A90/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1653050446711.png" alt="jthi_0-1653050446711.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The formula might look a bit complicated, but works with the example data&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;:S[Col Max(Col Min(Row(), :F, :o&lt;/img&gt; == 5), :F)]&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but it should be fairly easy to understand if you split it into three different formulas (I have attached data table with these). Idea is that first you get the rows numbers per fruit based on if Order is 5 or not using Col Min(). Then you use Col Max() to get maximum value of that column. Finally use the row number to get value from :Size column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 20 May 2022 12:45:14 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2022-05-20T12:45:14Z</dc:date>
    <item>
      <title>Formula column where all row values are a certain column value matching another column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-column-where-all-row-values-are-a-certain-column-value/m-p/488991#M73241</link>
      <description>&lt;P&gt;I have a table like this&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Feli_0-1653049390895.png" style="width: 216px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/42604iA05D91CE062C3EE5/image-dimensions/216x293?v=v2" width="216" height="293" role="button" title="Feli_0-1653049390895.png" alt="Feli_0-1653049390895.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and want to create a new formula column (reference size fruit) where the row value is the value to the Column "Size", but with the condition that the order is 5 and the value updates for each fruit type.&lt;/P&gt;&lt;P&gt;E.g., the result should look like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Feli_1-1653049621839.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/42605iC531AF1996C3B1BF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Feli_1-1653049621839.png" alt="Feli_1-1653049621839.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I can do it using a nasty workaround (marking 5 in column "order", select matching values, do a subset using selected rows and update the original table with this) or I could write a JSL script, but I would prefer a Formula column solution for compactness.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:48:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-column-where-all-row-values-are-a-certain-column-value/m-p/488991#M73241</guid>
      <dc:creator>Feli</dc:creator>
      <dc:date>2023-06-10T23:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: Formula column where all row values are a certain column value matching another column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-column-where-all-row-values-are-a-certain-column-value/m-p/489013#M73242</link>
      <description>&lt;P&gt;As no example data table (images won't really work as data tables), I wrote smaller table to use as an example.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1653050446711.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/42606i2E76B3B0A0D59A90/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1653050446711.png" alt="jthi_0-1653050446711.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The formula might look a bit complicated, but works with the example data&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;:S[Col Max(Col Min(Row(), :F, :o&lt;/img&gt; == 5), :F)]&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but it should be fairly easy to understand if you split it into three different formulas (I have attached data table with these). Idea is that first you get the rows numbers per fruit based on if Order is 5 or not using Col Min(). Then you use Col Max() to get maximum value of that column. Finally use the row number to get value from :Size column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 12:45:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-column-where-all-row-values-are-a-certain-column-value/m-p/489013#M73242</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-05-20T12:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: Formula column where all row values are a certain column value matching another column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-column-where-all-row-values-are-a-certain-column-value/m-p/491089#M73293</link>
      <description>&lt;P&gt;It's magic! Thank you, that was exactly what I was looking for.&lt;/P&gt;&lt;P&gt;Sorry for forgetting to attach my demo table.&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 05:44:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-column-where-all-row-values-are-a-certain-column-value/m-p/491089#M73293</guid>
      <dc:creator>Feli</dc:creator>
      <dc:date>2022-05-24T05:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: Formula column where all row values are a certain column value matching another column</title>
      <link>https://community.jmp.com/t5/Discussions/Formula-column-where-all-row-values-are-a-certain-column-value/m-p/491750#M73315</link>
      <description>&lt;P&gt;I don't have a better solution to offer, but I think this solution may cause incorrect results if the order == 5 for any of the groups is the first row of a given group. For example either if it is out of order, or if starts at 5.&amp;nbsp; Depending on what the real data looks like, it may or may not be an issue, or maybe it could be solved with sorting etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: This appears to work but I didn't test much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;stRows = Current Data Table() &amp;lt;&amp;lt; get rows where( :F[Row()] == :F &amp;amp; :o&lt;/img&gt; == 5 );
aa = Associative Array( :F[stRows], stRows );
:S[aa[:F[Row()]]];&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 May 2022 19:14:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Formula-column-where-all-row-values-are-a-certain-column-value/m-p/491750#M73315</guid>
      <dc:creator>mikedriscoll</dc:creator>
      <dc:date>2022-05-24T19:14:49Z</dc:date>
    </item>
  </channel>
</rss>

