<?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: Conditional sums in script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Conditional-sums-in-script/m-p/935138#M970965</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi leonardo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit; color: #0000ff;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt;set&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; &lt;/SPAN&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&lt;EM style="font-weight: inherit; font-size: 10pt; font-family: inherit; color: #808080;"&gt;LastClosedMonth&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; = 8;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: inherit; color: #0000ff;"&gt;Set&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; &lt;/SPAN&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&lt;EM style="font-weight: inherit; font-size: 10pt; font-family: inherit; color: #808080;"&gt;counter&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;=8;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: inherit; color: #0000ff;"&gt;Do&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit; color: #0000ff;"&gt;while&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit; color: #800000;"&gt;counter&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; &amp;lt; 12&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;&lt;STRONG style="font-family: inherit; font-style: inherit; font-size: 10pt; color: #0000ff;"&gt;load *,&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;(ForecastYTD - ActualYTD) / (12 - $(LastClosedMonth)) as Forecast,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;....&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: inherit; color: #0000ff;"&gt;load&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: inherit; color: #0000ff;"&gt;.....&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if (Area = 'Actuals', sum (Value),0) as ActualYTD,&lt;BR /&gt;if (Area = 'Forecast', sum (Value),0) as ForecastYTD,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; .... &lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit; color: #0000ff;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt;SQL&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; select * FROM ....&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 11 Sep 2015 17:51:28 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-09-11T17:51:28Z</dc:date>
    <item>
      <title>Conditional sums in script</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-sums-in-script/m-p/935135#M970962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good afternoon,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My data source is a SQL DB with the following line structure&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Year / Month / CostCenter / Account / Value / ValueType&lt;/P&gt;&lt;P&gt;2015 / 005 / 4711ABCD Global Head of Marketing / 690037 Travel Expenses / 250.000 EUR / Budget&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The value types are Actuals / Budget / Forecast. While Actuals are split by month, Budget and Forecast aren´t i.e. technically they come on month 012.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to split Budget and Forecast to months. A good way to do so is to use actuals for (financially) closed months and distribute the remaining forecast (i.e. yearly forecast - yearly actuals) across the remaining months.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;&lt;STRONG&gt;set&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 10pt;"&gt;LastClosedMonth&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; = 8;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 10pt;"&gt;Set&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 10pt;"&gt;counter&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt;=8;&lt;BR /&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 10pt;"&gt;Do&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;while&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 10pt;"&gt;counter&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &amp;lt; 12&lt;BR /&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 10pt;"&gt;load&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 10pt;"&gt; .....&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (Area = 'Actuals', sum (Value),0) as ActualYTD,&lt;BR /&gt;if (Area = 'Forecast', sum (Value),0) as ForecastYTD, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(ForecastYTD - ActualYTD) / (12 - $(LastClosedMonth)) as Forecast, &lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;&lt;STRONG&gt;SQL&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; select * FROM ....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;But get the&amp;nbsp; error message that &lt;/SPAN&gt;ForecastYTD, doesn´t exist...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Leonardo&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Sep 2015 14:44:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-sums-in-script/m-p/935135#M970962</guid>
      <dc:creator />
      <dc:date>2015-09-11T14:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional sums in script</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-sums-in-script/m-p/935136#M970963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if you ran the same select and replace the load with load *&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load *;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #0000ff;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;SQL&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; select * FROM ....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;and then open the table viewer (CTRL+T) does it exists a ForecastYTD field (pay attention to case)?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Sep 2015 14:51:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-sums-in-script/m-p/935136#M970963</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2015-09-11T14:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional sums in script</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-sums-in-script/m-p/935137#M970964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No it doesn´t, I define it with my statement. I just need it as an intermediate step for the calculation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Sep 2015 14:55:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-sums-in-script/m-p/935137#M970964</guid>
      <dc:creator />
      <dc:date>2015-09-11T14:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional sums in script</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-sums-in-script/m-p/935138#M970965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi leonardo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit; color: #0000ff;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt;set&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; &lt;/SPAN&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&lt;EM style="font-weight: inherit; font-size: 10pt; font-family: inherit; color: #808080;"&gt;LastClosedMonth&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; = 8;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: inherit; color: #0000ff;"&gt;Set&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; &lt;/SPAN&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&lt;EM style="font-weight: inherit; font-size: 10pt; font-family: inherit; color: #808080;"&gt;counter&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;=8;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: inherit; color: #0000ff;"&gt;Do&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit; color: #0000ff;"&gt;while&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit; color: #800000;"&gt;counter&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; &amp;lt; 12&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;&lt;STRONG style="font-family: inherit; font-style: inherit; font-size: 10pt; color: #0000ff;"&gt;load *,&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;(ForecastYTD - ActualYTD) / (12 - $(LastClosedMonth)) as Forecast,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;....&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: inherit; color: #0000ff;"&gt;load&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: inherit; color: #0000ff;"&gt;.....&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if (Area = 'Actuals', sum (Value),0) as ActualYTD,&lt;BR /&gt;if (Area = 'Forecast', sum (Value),0) as ForecastYTD,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; .... &lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit; color: #0000ff;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333320617676px; font-family: inherit;"&gt;SQL&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; select * FROM ....&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Sep 2015 17:51:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-sums-in-script/m-p/935138#M970965</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-11T17:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional sums in script</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-sums-in-script/m-p/935139#M970966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;&lt;STRONG&gt;Basically you are getting the error becuase you created a calculated filed.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;&lt;STRONG&gt;Try like this&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;&lt;STRONG&gt;set&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 10pt;"&gt;LastClosedMonth&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; = 8;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style="color: #0000ff; font-size: 10pt;"&gt;Set&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: #808080; font-size: 10pt;"&gt;counter&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt;=8;&lt;BR /&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style="color: #0000ff; font-size: 10pt;"&gt;Do&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;while&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 10pt;"&gt;counter&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &amp;lt; 12&lt;BR /&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style="color: #0000ff; font-size: 10pt;"&gt;load&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #0000ff; font-size: 10pt;"&gt; .....&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (Area = 'Actuals', sum (Value),0) as ActualYTD,&lt;BR /&gt;if (Area = 'Forecast', sum (Value),0) as ForecastYTD, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(if (Area = 'Forecast', sum (Value),0) - if (Area = 'Actuals', sum (Value),0)) / (12 - $(LastClosedMonth)) as Forecast, &lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;&lt;STRONG&gt;SQL&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; select * FROM ....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;hth&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Sasi&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Sep 2015 17:56:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-sums-in-script/m-p/935139#M970966</guid>
      <dc:creator>sasiparupudi1</dc:creator>
      <dc:date>2015-09-11T17:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional sums in script</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-sums-in-script/m-p/935140#M970967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You possibly have to use Preceding Load logic here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create ForecastYTD first then use ForecastYTD in the table immediately above table where you create ForecastYTD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set LastClosedMonth = 8;&lt;/P&gt;&lt;P&gt;Set counter=8;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do while counter &amp;lt; 12&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;,(ForecastYTD - ActualYTD) / (12 - $(LastClosedMonth)) as Forecast&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (Area = 'Actuals', sum (Value),0) as ActualYTD,&lt;/P&gt;&lt;P&gt;if (Area = 'Forecast', sum (Value),0) as ForecastYTD&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQL select * FROM ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also read &lt;A href="https://community.qlik.com/qlik-blogpost/2972"&gt;Preceding Load&lt;/A&gt;&lt;/P&gt;&lt;P&gt;By HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Sep 2015 23:31:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-sums-in-script/m-p/935140#M970967</guid>
      <dc:creator>Gabriel</dc:creator>
      <dc:date>2015-09-11T23:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional sums in script</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-sums-in-script/m-p/935141#M970968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Neetha. Following your suggestion, I get the error message:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Field not found - &amp;lt;Area&amp;gt;&lt;/P&gt;&lt;P&gt;SQL select * FROM GISdb.dbo."SAP_SO_Report" where CD = 'D' and Year &amp;gt; 2013 and (Area = 'FCYEAR' or Area = 'ACTYTD')"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Area is the first variable in the " if (Area = 'Actuals', sum (Value),0) as ActualYTD," clause - how come the script cannot recognize it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Sep 2015 08:34:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-sums-in-script/m-p/935141#M970968</guid>
      <dc:creator />
      <dc:date>2015-09-14T08:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional sums in script</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-sums-in-script/m-p/935142#M970969</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Gabriel. Following your suggestion, I get the error message:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Field not found - &amp;lt;Area&amp;gt;&lt;/P&gt;&lt;P&gt;SQL select * FROM GISdb.dbo."SAP_SO_Report" where CD = 'D' and Year &amp;gt; 2013 and (Area = 'FCYEAR' or Area = 'ACTYTD')"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Area is the first variable in the " if (Area = 'Actuals', sum (Value),0) as ActualYTD," clause - how come the script cannot recognize it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Sep 2015 08:35:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-sums-in-script/m-p/935142#M970969</guid>
      <dc:creator />
      <dc:date>2015-09-14T08:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional sums in script</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-sums-in-script/m-p/935143#M970970</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;load *;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #0000ff; font-size: 13.3333px; font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&lt;STRONG&gt;SQL&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt;"&gt; select * FROM ....&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt;"&gt;and then open the table viewer (CTRL+T) Check if area field exists(case sensitive)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt;"&gt;or&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #0000ff; font-size: 13.3333320617676px; font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&lt;STRONG&gt;set&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;&lt;STRONG style="color: #808080; font-size: 10pt; font-family: inherit; font-weight: inherit;"&gt;&lt;EM&gt;LastClosedMonth&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; = 8;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: inherit; color: #0000ff;"&gt;&lt;STRONG&gt;Set&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-family: inherit;"&gt;&lt;STRONG style="color: #808080; font-size: 10pt; font-family: inherit; font-weight: inherit;"&gt;&lt;EM&gt;counter&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;=8;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: inherit; color: #0000ff;"&gt;&lt;STRONG&gt;Do&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit; color: #0000ff;"&gt;while&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit; color: #800000;"&gt;counter&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; &amp;lt; 12&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&lt;STRONG&gt;load *,&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;(ForecastYTD - ActualYTD) / (12 - $(LastClosedMonth)) as Forecast,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;....&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: inherit; color: #0000ff;"&gt;&lt;STRONG&gt;load&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-style: inherit; font-size: 10pt; font-family: inherit; color: #0000ff;"&gt;&lt;STRONG&gt;.....&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if (Area = 'Actuals', sum (Value),0) as ActualYTD,&lt;BR /&gt;if (Area = 'Forecast', sum (Value),0) as ForecastYTD,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;....&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;where CD = 'D' and Year &amp;gt; 2013 and Area = {'FCYEAR' , 'ACTYTD'};// try (&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Area = 'FCYEAR'&amp;nbsp; or &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Area =&amp;nbsp; 'ACTYTD')&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #0000ff; font-size: 13.3333320617676px; font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&lt;STRONG&gt;SQL&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; select * FROM ....&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;another option:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-style: inherit; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-weight: inherit;"&gt;SQL select * FROM GISdb.dbo."SAP_SO_Report" &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-style: inherit; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-weight: inherit;"&gt;where CD = 'D' and Year &amp;gt; 2013 and Area &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px;"&gt;IN (&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;'FCYEAR'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px;"&gt;,&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt; 'ACTYTD'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px;"&gt;,...);&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Sep 2015 09:01:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-sums-in-script/m-p/935143#M970970</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-14T09:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional sums in script</title>
      <link>https://community.qlik.com/t5/QlikView/Conditional-sums-in-script/m-p/935144#M970971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if it is a variable,use it like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if ('$(Area)' = 'Actuals', sum (Value),0) as ActualYTD,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if ('$(Area)' = 'Forecast', sum (Value),0) as ForecastYTD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hth&lt;/P&gt;&lt;P&gt;Sasi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Sep 2015 09:09:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Conditional-sums-in-script/m-p/935144#M970971</guid>
      <dc:creator>sasiparupudi1</dc:creator>
      <dc:date>2015-09-14T09:09:32Z</dc:date>
    </item>
  </channel>
</rss>

