<?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 sum function in script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/sum-function-in-script/m-p/195298#M55851</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Remove &lt;EM&gt;that&lt;/EM&gt; group by. It doesn't belong on &lt;EM&gt;that&lt;/EM&gt; load. Add a NEW load after it. Unfortunately, you didn't use the same field names in your example as you do in your actual script, so I'm just guessing at which field names you want in the second table, but you want to do &lt;EM&gt;exactly&lt;/EM&gt; what he said but with your field names:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;Table_B:&lt;BR /&gt;NOCONCATENATE LOAD&lt;BR /&gt;JC.CONTRACT_JOB,&lt;BR /&gt;if(sum(TotalCostForecast)&amp;gt;sum(TotalCostActual),'GOOD','BAD') as Result&lt;BR /&gt;RESIDENT JC&lt;BR /&gt;GROUP BY JC.CONTRACT_JOB;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Dec 2009 00:00:04 GMT</pubDate>
    <dc:creator>johnw</dc:creator>
    <dc:date>2009-12-24T00:00:04Z</dc:date>
    <item>
      <title>sum function in script</title>
      <link>https://community.qlik.com/t5/QlikView/sum-function-in-script/m-p/195295#M55848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello fellow users,&lt;/P&gt;&lt;P&gt;I would like to do a calculation in the script and I don't know how and if it is possible. Here is an excample:&lt;/P&gt;&lt;P&gt;Table 1a:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 330pt; border-collapse: collapse;" width="440"&gt;&lt;COLGROUP&gt;&lt;COL style="width: 48pt;" width="64" /&gt;&lt;COL style="width: 61pt; mso-width-source: userset; mso-width-alt: 2962;" width="81" /&gt;&lt;COL style="width: 80pt; mso-width-source: userset; mso-width-alt: 3913;" width="107" /&gt;&lt;COL style="width: 93pt; mso-width-source: userset; mso-width-alt: 4534;" width="124" /&gt;&lt;COL style="width: 48pt;" width="64" /&gt;&lt;/COLGROUP&gt;&lt;TBODY&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD class="xl24" height="17" style="width: 48pt; height: 12.75pt; background-color: transparent; border: windowtext 0.5pt solid;" width="64"&gt;Contract&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext 0.5pt solid; border-left: windowtext; width: 61pt; border-bottom: windowtext 0.5pt solid; background-color: transparent;" width="81"&gt;Sub-contract&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext 0.5pt solid; border-left: windowtext; width: 80pt; border-bottom: windowtext 0.5pt solid; background-color: transparent;" width="107"&gt;ForcastTotalCost&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext 0.5pt solid; border-left: windowtext; width: 93pt; border-bottom: windowtext 0.5pt solid; background-color: transparent;" width="124"&gt;ForecastActualCost&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext 0.5pt solid; border-left: windowtext; width: 48pt; border-bottom: windowtext 0.5pt solid; background-color: transparent;" width="64"&gt;Result&lt;/TD&gt;&lt;/TR&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD align="right" class="xl24" height="17" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext 0.5pt solid; border-bottom: windowtext 0.5pt solid; height: 12.75pt; background-color: transparent;"&gt;3000&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;3000-a&lt;/TD&gt;&lt;TD align="right" class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;4000&lt;/TD&gt;&lt;TD align="right" class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;2000&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;GOOD&lt;/TD&gt;&lt;/TR&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD align="right" class="xl24" height="17" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext 0.5pt solid; border-bottom: windowtext 0.5pt solid; height: 12.75pt; background-color: transparent;"&gt;3000&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;3000-b&lt;/TD&gt;&lt;TD align="right" class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;2500&lt;/TD&gt;&lt;TD align="right" class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;3000&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;BAD&lt;/TD&gt;&lt;/TR&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD align="right" class="xl24" height="17" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext 0.5pt solid; border-bottom: windowtext 0.5pt solid; height: 12.75pt; background-color: transparent;"&gt;3001&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;3001-a&lt;/TD&gt;&lt;TD align="right" class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;3000&lt;/TD&gt;&lt;TD align="right" class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;2000&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;GOOD&lt;/TD&gt;&lt;/TR&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD align="right" class="xl24" height="17" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext 0.5pt solid; border-bottom: windowtext 0.5pt solid; height: 12.75pt; background-color: transparent;"&gt;3001&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;3001-b&lt;/TD&gt;&lt;TD align="right" class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;200&lt;/TD&gt;&lt;TD align="right" class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;400&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;BAD&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I would like to calculate the column Result with the following formula:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If(ForcastTotalCost &amp;gt;ForecastActualCost , GOOD, BAD) AS Result.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;The Column result gives the following outcome as shown on table 1a above.&lt;/P&gt;&lt;P&gt;The problem now is that the script calculated per row and a row is a Sub-Contract. I would like to do the calculation per Contract, because on a contract total the Colum result should be GOOD and now 3000-a is GOOD and 3000-b is BAD. Does someone know how I can Sum the rows and do the calculation like on table b below??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 330pt; border-collapse: collapse;" width="440"&gt;&lt;COLGROUP&gt;&lt;COL style="width: 48pt;" width="64" /&gt;&lt;COL style="width: 61pt; mso-width-source: userset; mso-width-alt: 2962;" width="81" /&gt;&lt;COL style="width: 80pt; mso-width-source: userset; mso-width-alt: 3913;" width="107" /&gt;&lt;COL style="width: 93pt; mso-width-source: userset; mso-width-alt: 4534;" width="124" /&gt;&lt;COL style="width: 48pt;" width="64" /&gt;&lt;/COLGROUP&gt;&lt;TBODY&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD class="xl24" height="17" style="width: 48pt; height: 12.75pt; background-color: transparent; border: windowtext 0.5pt solid;" width="64"&gt;Contract&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext 0.5pt solid; border-left: windowtext; width: 61pt; border-bottom: windowtext 0.5pt solid; background-color: transparent;" width="81"&gt;Sub-contract&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext 0.5pt solid; border-left: windowtext; width: 80pt; border-bottom: windowtext 0.5pt solid; background-color: transparent;" width="107"&gt;ForcastTotalCost&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext 0.5pt solid; border-left: windowtext; width: 93pt; border-bottom: windowtext 0.5pt solid; background-color: transparent;" width="124"&gt;ForecastActualCost&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext 0.5pt solid; border-left: windowtext; width: 48pt; border-bottom: windowtext 0.5pt solid; background-color: transparent;" width="64"&gt;Result&lt;/TD&gt;&lt;/TR&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD align="right" class="xl24" height="17" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext 0.5pt solid; border-bottom: windowtext 0.5pt solid; height: 12.75pt; background-color: transparent;"&gt;3000&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;3000-a&lt;/TD&gt;&lt;TD align="right" class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;4000&lt;/TD&gt;&lt;TD align="right" class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;2000&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;GOOD&lt;/TD&gt;&lt;/TR&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD align="right" class="xl24" height="17" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext 0.5pt solid; border-bottom: windowtext 0.5pt solid; height: 12.75pt; background-color: transparent;"&gt;3000&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;3000-b&lt;/TD&gt;&lt;TD align="right" class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;2500&lt;/TD&gt;&lt;TD align="right" class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;3000&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;GOOD&lt;/TD&gt;&lt;/TR&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD align="right" class="xl24" height="17" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext 0.5pt solid; border-bottom: windowtext 0.5pt solid; height: 12.75pt; background-color: transparent;"&gt;3001&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;3001-a&lt;/TD&gt;&lt;TD align="right" class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;3000&lt;/TD&gt;&lt;TD align="right" class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;2000&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;GOOD&lt;/TD&gt;&lt;/TR&gt;&lt;TR height="17" style="height: 12.75pt;"&gt;&lt;TD align="right" class="xl24" height="17" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext 0.5pt solid; border-bottom: windowtext 0.5pt solid; height: 12.75pt; background-color: transparent;"&gt;3001&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;3001-b&lt;/TD&gt;&lt;TD align="right" class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;200&lt;/TD&gt;&lt;TD align="right" class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;400&lt;/TD&gt;&lt;TD class="xl24" style="border-right: windowtext 0.5pt solid; border-top: windowtext; border-left: windowtext; border-bottom: windowtext 0.5pt solid; background-color: transparent;"&gt;GOOD&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Hope this is understandable for you guys.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Aissam&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Dec 2009 21:23:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-function-in-script/m-p/195295#M55848</guid>
      <dc:creator />
      <dc:date>2009-12-22T21:23:39Z</dc:date>
    </item>
    <item>
      <title>sum function in script</title>
      <link>https://community.qlik.com/t5/QlikView/sum-function-in-script/m-p/195296#M55849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try the following Script&lt;/P&gt;&lt;P style="font-style: italic; line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;Table_A:&lt;/P&gt;&lt;P style="font-weight: bold; line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;LOAD&lt;/P&gt;&lt;P style="line-height:normal;margin:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;Contract,&lt;/P&gt;&lt;P style="line-height:normal;margin:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;[Sub-contract],&lt;/P&gt;&lt;P style="line-height:normal;margin:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;ForcastTotalCost,&lt;/P&gt;&lt;P style="line-height:normal;margin:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;ForecastActualCost&lt;/P&gt;&lt;P style="line-height:normal;margin:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;B&gt;FROM&lt;/B&gt; DB;&lt;/P&gt;&lt;P style="line-height:normal;margin:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;/P&gt;&lt;P style="line-height:normal;margin:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;/P&gt;&lt;P style="font-style: italic; line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;Table_B:&lt;/P&gt;&lt;P style="line-height:normal;margin:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;B&gt;NOCONCATENATE&lt;/B&gt; &lt;B&gt;LOAD&lt;/B&gt;&lt;/P&gt;&lt;P style="line-height:normal;margin:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;Contract,&lt;/P&gt;&lt;P style="line-height:normal;margin:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;if(sum(ForcastTotalCost)&amp;gt;sum(ForecastActualCost),'GOOD','BAD') &lt;B&gt;as&lt;/B&gt; Result&lt;/P&gt;&lt;P style="line-height:normal;margin:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;B&gt;FROM&lt;/B&gt; DB&lt;/P&gt;&lt;P style="line-height:normal;margin:0cm 0cm 0pt;mso-layout-grid-align:none;"&gt;&lt;B&gt;Group&lt;/B&gt; &lt;B&gt;By&lt;/B&gt; Contract;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Dec 2009 21:50:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-function-in-script/m-p/195296#M55849</guid>
      <dc:creator />
      <dc:date>2009-12-22T21:50:41Z</dc:date>
    </item>
    <item>
      <title>sum function in script</title>
      <link>https://community.qlik.com/t5/QlikView/sum-function-in-script/m-p/195297#M55850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply. But the Group By gives problems. I receive the following error message when I run the script. Do you know what is wrong with this script?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Aggregation expressions required by GROUP BY clause&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;JC.CONTRACT_JOB,&lt;/P&gt;&lt;P&gt;JC.OpenPoTotal,&lt;/P&gt;&lt;P&gt;JC.LABOR_ACTUAL,&lt;/P&gt;&lt;P&gt;JC.LABOR_ACTUAL as LaborActual,&lt;/P&gt;&lt;P&gt;JC.BURDEN_ACTUAL,&lt;/P&gt;&lt;P&gt;JC.LABOR_EST,&lt;/P&gt;&lt;P&gt;JC.BURDEN_EST,&lt;/P&gt;&lt;P&gt;JC.ENG_ACTUAL,&lt;/P&gt;&lt;P&gt;JC.ENG_ACTUAL as EngActual,&lt;/P&gt;&lt;P&gt;JC.EXT_COST_ACTUAL,&lt;/P&gt;&lt;P&gt;JC.ENGINEERING_EST,&lt;/P&gt;&lt;P&gt;JC.MAT_ACTUAL + JC.EXT_COST_ACTUAL as MaterialProjects,&lt;/P&gt;&lt;P&gt;JC.MAT_ACTUAL,&lt;/P&gt;&lt;P&gt;JC.MAT_ACTUAL + JC.EXT_COST_ACTUAL as MatActual,&lt;/P&gt;&lt;P&gt;JC.MAT_ACTUAL + JC.EXT_COST_ACTUAL + JC.LABOR_ACTUAL + JC.ENG_ACTUAL as TotalCostActual,&lt;/P&gt;&lt;P&gt;JC.MATERIAL_EST,&lt;/P&gt;&lt;P&gt;JC.MATERIAL_EST - JC.FREIGHT_EST as MatForcast,&lt;/P&gt;&lt;P&gt;JC.MATERIAL_EST - JC.FREIGHT_EST + JC.LABOR_EST + JC.ENGINEERING_EST as TotalCostForecast,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if((JC.LABOR_ACTUAL+JC.ENG_ACTUAL+JC.MAT_ACTUAL +JC.EXT_COST_ACTUAL+JC.OpenPoTotal) &amp;gt; (JC.MATERIAL_EST - JC.FREIGHT_EST +JC.LABOR_EST + JC.ENGINEERING_EST),&lt;/P&gt;&lt;P&gt;(JC.LABOR_ACTUAL+JC.ENG_ACTUAL+JC.MAT_ACTUAL+ JC.EXT_COST_ACTUAL+JC.OpenPoTotal),&lt;/P&gt;&lt;P&gt;(JC.MATERIAL_EST - JC.FREIGHT_EST +JC.LABOR_EST +JC.ENGINEERING_EST)) as TotalActualCostRedsheetContractLevel&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RESIDENT JC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Group By JC.CONTRACT_JOB&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Dec 2009 21:23:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-function-in-script/m-p/195297#M55850</guid>
      <dc:creator />
      <dc:date>2009-12-23T21:23:44Z</dc:date>
    </item>
    <item>
      <title>sum function in script</title>
      <link>https://community.qlik.com/t5/QlikView/sum-function-in-script/m-p/195298#M55851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Remove &lt;EM&gt;that&lt;/EM&gt; group by. It doesn't belong on &lt;EM&gt;that&lt;/EM&gt; load. Add a NEW load after it. Unfortunately, you didn't use the same field names in your example as you do in your actual script, so I'm just guessing at which field names you want in the second table, but you want to do &lt;EM&gt;exactly&lt;/EM&gt; what he said but with your field names:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;Table_B:&lt;BR /&gt;NOCONCATENATE LOAD&lt;BR /&gt;JC.CONTRACT_JOB,&lt;BR /&gt;if(sum(TotalCostForecast)&amp;gt;sum(TotalCostActual),'GOOD','BAD') as Result&lt;BR /&gt;RESIDENT JC&lt;BR /&gt;GROUP BY JC.CONTRACT_JOB;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Dec 2009 00:00:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sum-function-in-script/m-p/195298#M55851</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-12-24T00:00:04Z</dc:date>
    </item>
  </channel>
</rss>

