<?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: looping and where condition help? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/looping-and-where-condition-help/m-p/978534#M645422</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank for you suggestion Marcus, I took your suggestions in my implementation, but i asked one more query on that thread which is similar to this thread, it may be a overlook. If i&amp;nbsp; bothered you with my actions, sorry for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Ganesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Oct 2015 10:45:07 GMT</pubDate>
    <dc:creator>ganeshreddy</dc:creator>
    <dc:date>2015-10-28T10:45:07Z</dc:date>
    <item>
      <title>looping and where condition help?</title>
      <link>https://community.qlik.com/t5/QlikView/looping-and-where-condition-help/m-p/978529#M645404</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;Can anyone explain , how can we add where condition for Wo_completionDate between the beginning of prior month and the end of current month(two months data like this month and previous month) and i need to put each KPI in a for loop to calculate PKI for each month.&lt;/P&gt;&lt;P&gt;Please check commented lines in code i.e where we need to implement the code .Please find the attached documents.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Summary:&lt;/P&gt;&lt;P&gt;LOAD wo_number, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pri_code, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wc_code, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Proj_number, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Client_source, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wo_completionDate&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;&lt;C&gt;&lt;/C&gt;&lt;/P&gt;&lt;P&gt;(ooxml, embedded labels, table is Sheet1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let vMinMonth = min(num(month(floor(wo_completionDate)),'00'));&lt;/P&gt;&lt;P&gt;let vMaxMonth = max(num(month(floor(wo_completionDate)),'00'));&lt;/P&gt;&lt;P&gt;let vMinYear=min(year(floor(wo_completionDate)));&lt;/P&gt;&lt;P&gt;let vMaxYear=max(year(floor(wo_completionDate)));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//loop should start for each month KPI1 calculation&lt;/P&gt;&lt;P&gt;left join(Summary)&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Client_source,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; count(wo_number) as KPI1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; resident Summary where pri_code= '1'&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //where condition has to be here for Wo_completionDate between the beginning of prior month and the end of current month&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; group by Client_source;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;//loop should start for each month KPI2 calculation&lt;/P&gt;&lt;P&gt;left join(Summary)&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Client_source,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; count(wo_number) as KPI1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; resident Summary where pri_code= '2'&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //where condition has to be here for Wo_completionDate between the beginning of prior month and the end of current month&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; group by Client_source;&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;Regards,&lt;/P&gt;&lt;P&gt;Ganesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Oct 2015 09:50:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/looping-and-where-condition-help/m-p/978529#M645404</guid>
      <dc:creator>ganeshreddy</dc:creator>
      <dc:date>2015-10-28T09:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: looping and where condition help?</title>
      <link>https://community.qlik.com/t5/QlikView/looping-and-where-condition-help/m-p/978530#M645409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The condition would be &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Where Wo_completionDate &amp;gt;= MonthStart(Today(), -1) And Wo_completionDate &amp;lt;= MonthEnd(Today())&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Oct 2015 09:58:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/looping-and-where-condition-help/m-p/978530#M645409</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2015-10-28T09:58:42Z</dc:date>
    </item>
    <item>
      <title>Re: looping and where condition help?</title>
      <link>https://community.qlik.com/t5/QlikView/looping-and-where-condition-help/m-p/978531#M645412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your second question is about the code. You cannot do a join inside a loop. This is because a join adds fields to the table. After the first iteration of the loop, the fields have already been added, so they will be considered part of the join key, rather than fields to add.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The solution is to build each table inside the loop, and then join the tables after the loop completes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Oct 2015 10:01:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/looping-and-where-condition-help/m-p/978531#M645412</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2015-10-28T10:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: looping and where condition help?</title>
      <link>https://community.qlik.com/t5/QlikView/looping-and-where-condition-help/m-p/978532#M645416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ganesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not going to attempt to answer your question here as I've posted some suggestions on a very similar thread you started a couple of days ago, and I don't think you understood what I suggested that time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will however point out what I think might be an error in your code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your Summary table includes wo_number (work order number?). Surely this is transaction level data, and not the level at which you want to summarise? Especially as your KPI 1 calculation is 'count(wo_number)'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Oct 2015 10:05:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/looping-and-where-condition-help/m-p/978532#M645416</guid>
      <dc:creator>marcus_malinow</dc:creator>
      <dc:date>2015-10-28T10:05:52Z</dc:date>
    </item>
    <item>
      <title>Re: looping and where condition help?</title>
      <link>https://community.qlik.com/t5/QlikView/looping-and-where-condition-help/m-p/978533#M645419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your suggestion jonathan, now i understood how to add looped data to summary table here. But in my first question about where clause is to get data for every month in data, not only for this month and previous month data. Your suggestion for where clause will only give september 2015 and october 2015 data. Actually this is where i got stuck in my previous thread as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Oct 2015 10:39:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/looping-and-where-condition-help/m-p/978533#M645419</guid>
      <dc:creator>ganeshreddy</dc:creator>
      <dc:date>2015-10-28T10:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: looping and where condition help?</title>
      <link>https://community.qlik.com/t5/QlikView/looping-and-where-condition-help/m-p/978534#M645422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank for you suggestion Marcus, I took your suggestions in my implementation, but i asked one more query on that thread which is similar to this thread, it may be a overlook. If i&amp;nbsp; bothered you with my actions, sorry for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Ganesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Oct 2015 10:45:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/looping-and-where-condition-help/m-p/978534#M645422</guid>
      <dc:creator>ganeshreddy</dc:creator>
      <dc:date>2015-10-28T10:45:07Z</dc:date>
    </item>
  </channel>
</rss>

