<?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 Sum in Script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-Sum-in-Script/m-p/783962#M661741</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nevermind the sequence of LOAD/SELECT statements. Add one or more grouping field to both the SELECT and PRECEDING LOAD. IF you want to Sum() and not end up with a single result row, you should add a grouping field. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise, drop the GROUP BY/SUM logic and add three Funnel&lt;EM&gt;XX&lt;/EM&gt; fields to &lt;EM style="text-decoration: underline;"&gt;every&lt;/EM&gt; row. For each individual row, you will only fill one of them.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Feb 2015 21:31:38 GMT</pubDate>
    <dc:creator>Peter_Cammaert</dc:creator>
    <dc:date>2015-02-24T21:31:38Z</dc:date>
    <item>
      <title>How to Sum in Script</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-Sum-in-Script/m-p/783956#M661733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've created expressions in my app that give me the appropriate "buckets", but I need to export the data as a .txt, so I presume I need to do it in the script.&amp;nbsp; I've tried adding these lines to the script, but the load fails.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;CloseDate&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &amp;gt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Now&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;() &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;AND&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;CloseDate&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &amp;lt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Now&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;()+29, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Total_SIMs__c&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;)) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Funnel30&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Sum&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;CloseDate&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &amp;gt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Now&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;()+30 &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;AND&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;CloseDate&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &amp;lt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Now&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;()+59, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Total_SIMs__c&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;)) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Funnel60&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Sum&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;CloseDate&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &amp;gt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Now&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;()+60 &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;AND&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;CloseDate&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &amp;lt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Now&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;()+89, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Total_SIMs__c&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;)) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Funnel90&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the best way to get thse sum categories into the final .qvd file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp; Dan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 21:04:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-Sum-in-Script/m-p/783956#M661733</guid>
      <dc:creator />
      <dc:date>2015-02-24T21:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to Sum in Script</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-Sum-in-Script/m-p/783957#M661735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;theTable:&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;categories,&lt;/P&gt;&lt;P&gt;sum &lt;SPAN style="color: #000000; font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;CloseDate&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &amp;gt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Now&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;() &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;AND&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;CloseDate&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &amp;lt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Now&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;()+29, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Total_SIMs__c&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;)) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Funnel30&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Sum&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;CloseDate&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &amp;gt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Now&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;()+30 &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;AND&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;CloseDate&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &amp;lt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Now&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;()+59, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Total_SIMs__c&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;)) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Funnel60&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Sum&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;CloseDate&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &amp;gt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Now&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;()+60 &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;AND&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;CloseDate&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &amp;lt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Now&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;()+89, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Total_SIMs__c&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;)) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Funnel90&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;resident sourceTableName&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;group by categories;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;store theTable into theTable.txt (txt);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;----&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 8pt;"&gt;How does that look?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 21:08:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-Sum-in-Script/m-p/783957#M661735</guid>
      <dc:creator>oknotsen</dc:creator>
      <dc:date>2015-02-24T21:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to Sum in Script</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-Sum-in-Script/m-p/783958#M661736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may have to change the parameter of the sum() function, but actually a similar technique is possible with the GROUP BY clause. A LOAD statement works row-by-row and doesn't allow aggregation functions without a GROUP BY clause that groups rows with similar characteristics.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the LOAD statement entry in QV Desktop Help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 21:10:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-Sum-in-Script/m-p/783958#M661736</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2015-02-24T21:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to Sum in Script</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-Sum-in-Script/m-p/783959#M661737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the replies.&amp;nbsp; I should have mentioned that the LOAD statement is precdeing a SQL statement, so the load won't work because "categories" isn't in the SQL statement.&amp;nbsp; I also have a WHERE clause in the Load statement, so I presume the Group By would be after the Where.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 21:22:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-Sum-in-Script/m-p/783959#M661737</guid>
      <dc:creator />
      <dc:date>2015-02-24T21:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to Sum in Script</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-Sum-in-Script/m-p/783960#M661738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Indeed, GROUP BY comes after the WHERE clause.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 21:25:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-Sum-in-Script/m-p/783960#M661738</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2015-02-24T21:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to Sum in Script</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-Sum-in-Script/m-p/783961#M661740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So where is the categories coming from? Or am I misunderstand your data structure?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My script was assuming you have the table loaded already, categories is a field in it and you are summing some other field. I do a resident load on that table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 21:26:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-Sum-in-Script/m-p/783961#M661740</guid>
      <dc:creator>oknotsen</dc:creator>
      <dc:date>2015-02-24T21:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to Sum in Script</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-Sum-in-Script/m-p/783962#M661741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nevermind the sequence of LOAD/SELECT statements. Add one or more grouping field to both the SELECT and PRECEDING LOAD. IF you want to Sum() and not end up with a single result row, you should add a grouping field. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise, drop the GROUP BY/SUM logic and add three Funnel&lt;EM&gt;XX&lt;/EM&gt; fields to &lt;EM style="text-decoration: underline;"&gt;every&lt;/EM&gt; row. For each individual row, you will only fill one of them.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 21:31:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-Sum-in-Script/m-p/783962#M661741</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2015-02-24T21:31:38Z</dc:date>
    </item>
  </channel>
</rss>

