<?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 can I do this type of Count If expression in the script? [Better example] in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-can-I-do-this-type-of-Count-If-expression-in-the-script/m-p/840310#M295292</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are right sunindia I will do this soon and submit it! &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Jul 2015 12:25:58 GMT</pubDate>
    <dc:creator>jblomqvist</dc:creator>
    <dc:date>2015-07-09T12:25:58Z</dc:date>
    <item>
      <title>How can I do this type of Count If expression in the script? [Better example]</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-do-this-type-of-Count-If-expression-in-the-script/m-p/840307#M295289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry I don't think I explained full the extent of what I was trying to do with my Count If expression in the last thread.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="92388" alt="" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/92388_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No of Months &amp;lt;&amp;gt; 0 should count months where Actual Value is not 0.&lt;/P&gt;&lt;P&gt;In my example when it finds 12 months of value in a row then it will calculate the sum of those 12 months in the "Previous 12 months Actual Total" column.&lt;/P&gt;&lt;P&gt;This is based on if No of Months &amp;lt;&amp;gt; 0 = 12 at the moment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have two tables.&lt;/P&gt;&lt;P&gt;Transactions table holds CompanyCode and Actual Value.&lt;/P&gt;&lt;P&gt;MonthYear is held in a Calender table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So this data will vary company by company so for another company it might look like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="92389" alt="" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/92389_pastedImage_1.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know how I can get this to work? &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 11:19:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-do-this-type-of-Count-If-expression-in-the-script/m-p/840307#M295289</guid>
      <dc:creator>jblomqvist</dc:creator>
      <dc:date>2015-07-09T11:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: How can I do this type of Count If expression in the script? [Better example]</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-do-this-type-of-Count-If-expression-in-the-script/m-p/840308#M295290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think it would be better if you give the same data in form of Excel rather than giving us a screenshot. The only way we can test it out is if we have a sample to work with.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope that makes sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 11:34:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-do-this-type-of-Count-If-expression-in-the-script/m-p/840308#M295290</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-07-09T11:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: How can I do this type of Count If expression in the script? [Better example]</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-do-this-type-of-Count-If-expression-in-the-script/m-p/840309#M295291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;PFA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// test data&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;a:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;load&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; 'ABC' as Company,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; date( addmonths(makedate(2009,2), RecNo() -1),'MMM-YY') as MonthYear,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; if(RecNo()&amp;lt;3 or RecNo()=21, 0, 1*recno()) as ActualValue&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;AutoGenerate 34;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Concatenate (a)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;load&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; 'John' as Company,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; date( addmonths(makedate(2009,2), RecNo() -1),'MMM-YY') as MonthYear,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; if(RecNo()&amp;lt;3 or RecNo()=21, 0, 10*recno()) as ActualValue&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;AutoGenerate 34;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;// end test data&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;b:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;load &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; *,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; if(ActualValue=0 or Company&amp;lt;&amp;gt;peek(Company),0,rangemin(peek(NoOfMonthsNot0)+1,12)) as NoOfMonthsNot0&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident a&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;order by Company, MonthYear;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;DROP Table a;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;c:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;load &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; *,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; if(NoOfMonthsNot0=12, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; rangesum(&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Peek('ActualValue', -1),Peek('ActualValue', -2),Peek('ActualValue', -3),&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Peek('ActualValue', -4),Peek('ActualValue', -5),Peek('ActualValue', -6),&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Peek('ActualValue', -7),Peek('ActualValue', -8),Peek('ActualValue', -9),&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Peek('ActualValue', -10),Peek('ActualValue', -11),ActualValue&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; ), 0) as Prev12MonthsValue&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident b&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;order by Company, MonthYear;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;drop Table b;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="1.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/92396_1.png" style="height: auto; width: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 11:56:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-do-this-type-of-Count-If-expression-in-the-script/m-p/840309#M295291</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2015-07-09T11:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: How can I do this type of Count If expression in the script? [Better example]</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-do-this-type-of-Count-If-expression-in-the-script/m-p/840310#M295292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are right sunindia I will do this soon and submit it! &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 12:25:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-do-this-type-of-Count-If-expression-in-the-script/m-p/840310#M295292</guid>
      <dc:creator>jblomqvist</dc:creator>
      <dc:date>2015-07-09T12:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: How can I do this type of Count If expression in the script? [Better example]</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-do-this-type-of-Count-If-expression-in-the-script/m-p/840311#M295293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have attached the sample data and what I am trying to do in the original message. Thanks&amp;nbsp; &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 12:32:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-do-this-type-of-Count-If-expression-in-the-script/m-p/840311#M295293</guid>
      <dc:creator>jblomqvist</dc:creator>
      <dc:date>2015-07-09T12:32:54Z</dc:date>
    </item>
    <item>
      <title>Re: How can I do this type of Count If expression in the script? [Better example]</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-I-do-this-type-of-Count-If-expression-in-the-script/m-p/840312#M295294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table1:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD *,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(CumFlag = 12,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; RangeSum(ActualValue,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company'), Alt(Peek('ActualValue'), 0), 0),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company', -2), Alt(Peek('ActualValue', -2), 0), 0),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company', -3), Alt(Peek('ActualValue', -3), 0), 0),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company', -4), Alt(Peek('ActualValue', -4), 0), 0),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company', -5), Alt(Peek('ActualValue', -5), 0), 0),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company', -6), Alt(Peek('ActualValue', -6), 0), 0),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company', -7), Alt(Peek('ActualValue', -7), 0), 0),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company', -8), Alt(Peek('ActualValue', -8), 0), 0),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company', -9), Alt(Peek('ActualValue', -9), 0), 0),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company', -10), Alt(Peek('ActualValue', -10), 0), 0),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company', -11), Alt(Peek('ActualValue', -11), 0), 0)), Dual('No 12 months data', 0)) as [Previous 12 Actual Value Total];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD *,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; RangeSum(Flag,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company'), Alt(Peek('Flag'), 0), 0),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company', -2), Alt(Peek('Flag', -2), 0), 0),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company', -3), Alt(Peek('Flag', -3), 0), 0),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company', -4), Alt(Peek('Flag', -4), 0), 0),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company', -5), Alt(Peek('Flag', -5), 0), 0),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company', -6), Alt(Peek('Flag', -6), 0), 0),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company', -7), Alt(Peek('Flag', -7), 0), 0),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company', -8), Alt(Peek('Flag', -8), 0), 0),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company', -9), Alt(Peek('Flag', -9), 0), 0),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company', -10), Alt(Peek('Flag', -10), 0), 0),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Company = Peek('Company', -11), Alt(Peek('Flag', -11), 0), 0)) as CumFlag;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Company, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MonthYear, &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActualValue,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(ActualValue &amp;gt; 0, 1, 0) as Flag&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FROM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Community_171878.xlsx&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(ooxml, embedded labels, table is Sheet1);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/92394_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also attaching the qvw document for reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 12:53:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-I-do-this-type-of-Count-If-expression-in-the-script/m-p/840312#M295294</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-07-09T12:53:00Z</dc:date>
    </item>
  </channel>
</rss>

