<?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 write a formula that counts number of rows that are not excluded? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-write-a-formula-that-counts-number-of-rows-that-are-not/m-p/801416#M97706</link>
    <description>&lt;P&gt;There are other approaches in JMP which automatically take into account which rows are excluded and which ones are not.&lt;BR /&gt;&lt;BR /&gt;If you don't need a new column but just a single value, you can use a summary table with a transform column:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Summary( N( Transform Column( "one", Formula( !Excluded() ) ) ));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;If you need the value to process it further via JSL,&amp;nbsp;&lt;FONT face="courier new,courier"&gt;Summarize&lt;/FONT&gt;&amp;nbsp;provides an easy alternative:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

dt &amp;lt;&amp;lt; Select Rows( 5::12 ) &amp;lt;&amp;lt;Exclude;
summarize ( count = count(:height));	
count&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 23 Sep 2024 21:37:31 GMT</pubDate>
    <dc:creator>hogi</dc:creator>
    <dc:date>2024-09-23T21:37:31Z</dc:date>
    <item>
      <title>How to write a formula that counts number of rows that are not excluded?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-write-a-formula-that-counts-number-of-rows-that-are-not/m-p/801402#M97703</link>
      <description>&lt;P&gt;I am trying to write a simple formula that will count the number of rows in my datatable that are not excluded. I want the total to be updated as I change row states using the graph builder. In another part of the formula I was able to successfully use the Excluded () function, e.g.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;jsl&amp;gt; X = Col Sum( :MG1_2520_LH_Setting, Excluded() );&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I am using N Rows() to count the total number of rows and cannot see how to modify this function to only count the number of non-excluded rows.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 20:55:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-write-a-formula-that-counts-number-of-rows-that-are-not/m-p/801402#M97703</guid>
      <dc:creator>BrianB</dc:creator>
      <dc:date>2024-09-23T20:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a formula that counts number of rows that are not excluded?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-write-a-formula-that-counts-number-of-rows-that-are-not/m-p/801414#M97704</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have an ugly but usable solution: create a Dummy column populated with the value = 1 and then use the formula as you showed in JSL:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Col Sum(:Dummy, Excluded())&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;There is probably a much more elegant solution, so you may want to wait to accept the solution.&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;TS&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 21:08:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-write-a-formula-that-counts-number-of-rows-that-are-not/m-p/801414#M97704</guid>
      <dc:creator>Thierry_S</dc:creator>
      <dc:date>2024-09-23T21:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a formula that counts number of rows that are not excluded?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-write-a-formula-that-counts-number-of-rows-that-are-not/m-p/801415#M97705</link>
      <description>&lt;P&gt;You cannot use Col sum in "plain" JSL code to assign the result to a variable.&lt;BR /&gt;It'a a cool aggregation function which can be used in &lt;STRONG&gt;Column Formulas&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Col Sum sums up the individual entries of a column - and as&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/11634"&gt;@Thierry_S&lt;/a&gt;&amp;nbsp;indicates, you need a column with ones to count the rows. But actually, you don't need a real column, instead of a column, you can also specify "1".&lt;BR /&gt;If you just want to count rows which are NOT excluded, use:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Column( "non excluded",Formula( Col Number( If( !Excluded(), 1 ) ) ))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;The complicated syntax is necessary because by default the Col ... aggregation doesn't respect the excluded state - it uses all values of the column and therefore counts all rows.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 21:33:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-write-a-formula-that-counts-number-of-rows-that-are-not/m-p/801415#M97705</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-09-23T21:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a formula that counts number of rows that are not excluded?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-write-a-formula-that-counts-number-of-rows-that-are-not/m-p/801416#M97706</link>
      <description>&lt;P&gt;There are other approaches in JMP which automatically take into account which rows are excluded and which ones are not.&lt;BR /&gt;&lt;BR /&gt;If you don't need a new column but just a single value, you can use a summary table with a transform column:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Summary( N( Transform Column( "one", Formula( !Excluded() ) ) ));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;If you need the value to process it further via JSL,&amp;nbsp;&lt;FONT face="courier new,courier"&gt;Summarize&lt;/FONT&gt;&amp;nbsp;provides an easy alternative:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

dt &amp;lt;&amp;lt; Select Rows( 5::12 ) &amp;lt;&amp;lt;Exclude;
summarize ( count = count(:height));	
count&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 21:37:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-write-a-formula-that-counts-number-of-rows-that-are-not/m-p/801416#M97706</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-09-23T21:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a formula that counts number of rows that are not excluded?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-write-a-formula-that-counts-number-of-rows-that-are-not/m-p/801586#M97735</link>
      <description>&lt;P&gt;I was able to use the code as below to achieve what I needed. The other solutions worked as well but this was the easiest to implement for me. Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Col Number( If( !Excluded(), 1 ) )&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Sep 2024 14:58:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-write-a-formula-that-counts-number-of-rows-that-are-not/m-p/801586#M97735</guid>
      <dc:creator>BrianB</dc:creator>
      <dc:date>2024-09-24T14:58:25Z</dc:date>
    </item>
  </channel>
</rss>

