<?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: Count if id has at least one entry in following three Months in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Count-if-id-has-at-least-one-entry-in-following-three-Months/m-p/974776#M333287</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi steve,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;have a look at the PEEK() function in QlikView. Once you have sorted the data in a table - desc. by (userID and) month in this instance, I guess - it allows you to "look" from one record you are currently loading to the last or the one before_last or ...&lt;/P&gt;&lt;P&gt;You cannot of course peek into the records you have not yet loaded which is why you have to sort desc. by month.&lt;/P&gt;&lt;P&gt;=&amp;gt; Then you can build a corresp. IF_function.&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 regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DataNibbler&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S.: Bear in mind that, in order to use the ORDER BY clause (to sort), you need a RESIDENT LOAD as this is not possible in a "real" LOAD.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Oct 2015 07:52:26 GMT</pubDate>
    <dc:creator>datanibbler</dc:creator>
    <dc:date>2015-10-14T07:52:26Z</dc:date>
    <item>
      <title>Count if id has at least one entry in following three Months</title>
      <link>https://community.qlik.com/t5/QlikView/Count-if-id-has-at-least-one-entry-in-following-three-Months/m-p/974775#M333286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;i hope somebody can help me with this problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a Table like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;month&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;userId&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Event&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Jan&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Mar&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Jan&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Apr&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What i´m trying to achieve is a Table like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Jan&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Feb&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Mar&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Apr&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;P&gt;Count (distinct userIds with at least&lt;/P&gt;&lt;P&gt;one Event in following three Months&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The logic is, count every user in the given month, if he has a event in the follwing three months.&lt;/P&gt;&lt;P&gt;like Jan, then look in Jan, Feb and Mar if there is an Event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g.:&amp;nbsp; output for userid 1 is:&lt;/P&gt;&lt;P&gt;-count him in Jan, because he has at least one event in Jan or Feb or Mar&lt;/P&gt;&lt;P&gt;-count him in Feb, because he has at least one event in Feb or Mar, or Apr&lt;/P&gt;&lt;P&gt;-count hin in Mar, because he has at least one event in Mar or Apr, May&lt;/P&gt;&lt;P&gt;-NOT count him in Apr, because he has NOT at least one event in Apr or May or Jun&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope somebody can help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 07:40:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-if-id-has-at-least-one-entry-in-following-three-Months/m-p/974775#M333286</guid>
      <dc:creator />
      <dc:date>2015-10-14T07:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: Count if id has at least one entry in following three Months</title>
      <link>https://community.qlik.com/t5/QlikView/Count-if-id-has-at-least-one-entry-in-following-three-Months/m-p/974776#M333287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi steve,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;have a look at the PEEK() function in QlikView. Once you have sorted the data in a table - desc. by (userID and) month in this instance, I guess - it allows you to "look" from one record you are currently loading to the last or the one before_last or ...&lt;/P&gt;&lt;P&gt;You cannot of course peek into the records you have not yet loaded which is why you have to sort desc. by month.&lt;/P&gt;&lt;P&gt;=&amp;gt; Then you can build a corresp. IF_function.&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 regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DataNibbler&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S.: Bear in mind that, in order to use the ORDER BY clause (to sort), you need a RESIDENT LOAD as this is not possible in a "real" LOAD.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 07:52:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-if-id-has-at-least-one-entry-in-following-three-Months/m-p/974776#M333287</guid>
      <dc:creator>datanibbler</dc:creator>
      <dc:date>2015-10-14T07:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: Count if id has at least one entry in following three Months</title>
      <link>https://community.qlik.com/t5/QlikView/Count-if-id-has-at-least-one-entry-in-following-three-Months/m-p/974777#M333288</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;I think you cant solve this using set analysis. &lt;/P&gt;&lt;P&gt;So you have to use scripting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would try this idea:&lt;/P&gt;&lt;P&gt;1. you have a table "fact"&lt;/P&gt;&lt;P&gt;2. left join (fact) load ... month-1 as month, 1 as FlagActive2 resident fact&lt;/P&gt;&lt;P&gt;3. &lt;SPAN style="font-size: 13.3333px;"&gt;left join (fact) load ... month-2 as month, 1 as FlagActive3 resident fact where isnull(&lt;SPAN style="font-size: 13.3333px;"&gt;FlagActive2&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so you will have for each user in the each month 2 fields FlagActive2 and FlagActive3.&lt;/P&gt;&lt;P&gt;if(rangesum(FlagActive2,&lt;SPAN style="font-size: 13.3333px;"&gt;FlagActive3)&amp;gt;0,1,0)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;--- this your users.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope you have not only month but date to. in case that month has cycle values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However the main idea is written above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Sergey&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 07:56:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-if-id-has-at-least-one-entry-in-following-three-Months/m-p/974777#M333288</guid>
      <dc:creator>pokassov</dc:creator>
      <dc:date>2015-10-14T07:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: Count if id has at least one entry in following three Months</title>
      <link>https://community.qlik.com/t5/QlikView/Count-if-id-has-at-least-one-entry-in-following-three-Months/m-p/974778#M333289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Steve,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We can do it into Pivot table as slicing/dicing feature is their in Pivot table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Take USerID, Month as dimension and count of event as a measure...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See, if you can share some sample data? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 08:02:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-if-id-has-at-least-one-entry-in-following-three-Months/m-p/974778#M333289</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-10-14T08:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: Count if id has at least one entry in following three Months</title>
      <link>https://community.qlik.com/t5/QlikView/Count-if-id-has-at-least-one-entry-in-following-three-Months/m-p/974779#M333290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, my raw data looks like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Date&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;userId&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Event&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;01.01.2014&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;01.01.2014&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;...&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;...&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;...&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this data is connected to Calendar Table by the Date field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So for aggregated Month, User can have more Entries but in my case User should be count only once per Month&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 08:26:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-if-id-has-at-least-one-entry-in-following-three-Months/m-p/974779#M333290</guid>
      <dc:creator />
      <dc:date>2015-10-14T08:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: Count if id has at least one entry in following three Months</title>
      <link>https://community.qlik.com/t5/QlikView/Count-if-id-has-at-least-one-entry-in-following-three-Months/m-p/974780#M333291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Sergey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i tried your solution, but i couldn´t figure it out how to use it right.&lt;/P&gt;&lt;P&gt;could you please give me some sample data?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 09:17:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-if-id-has-at-least-one-entry-in-following-three-Months/m-p/974780#M333291</guid>
      <dc:creator />
      <dc:date>2015-10-14T09:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: Count if id has at least one entry in following three Months</title>
      <link>https://community.qlik.com/t5/QlikView/Count-if-id-has-at-least-one-entry-in-following-three-Months/m-p/974781#M333292</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;Sorry for not presentable syntax and look attach.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 10:02:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-if-id-has-at-least-one-entry-in-following-three-Months/m-p/974781#M333292</guid>
      <dc:creator>pokassov</dc:creator>
      <dc:date>2015-10-14T10:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: Count if id has at least one entry in following three Months</title>
      <link>https://community.qlik.com/t5/QlikView/Count-if-id-has-at-least-one-entry-in-following-three-Months/m-p/974782#M333293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your reply,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i thin it´s getting in the right way, but there are still some problems.&lt;/P&gt;&lt;P&gt;with your solution i only get an entry when there is an entry in given month for a user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so when user1 has only entries in Jan, Feb and Oct&lt;/P&gt;&lt;P&gt;The Flag "FlagActive" is only set in this rows.&lt;/P&gt;&lt;P&gt;So with your solution user1 has Flag "FlagActive" in Jan, Feb, Oct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But result should be: user1 has Flag "FlagActive" in Jan, Feb, Aug, Sep, Oct.&lt;/P&gt;&lt;P&gt;Because he had an Event in Oct, there should also Flags for Aug, Sep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 12:04:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-if-id-has-at-least-one-entry-in-following-three-Months/m-p/974782#M333293</guid>
      <dc:creator />
      <dc:date>2015-10-14T12:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: Count if id has at least one entry in following three Months</title>
      <link>https://community.qlik.com/t5/QlikView/Count-if-id-has-at-least-one-entry-in-following-three-Months/m-p/974783#M333294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, I don't see this requirement in the first post...&lt;/P&gt;&lt;P&gt;From the new point of view we can do something else:&lt;/P&gt;&lt;P&gt;1. Create a table with userID, MonthName for SignDate, and MonthName for ActivityDate with User's activity.&lt;/P&gt;&lt;P&gt;2. concatenate twice the same data except MonthName - use the same approach with AddMonth(..-1) and where Month Name of Sign Date&amp;lt;=Add Month(..-1)&lt;/P&gt;&lt;P&gt;this table represent your expectation&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Oct 2015 12:23:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-if-id-has-at-least-one-entry-in-following-three-Months/m-p/974783#M333294</guid>
      <dc:creator>pokassov</dc:creator>
      <dc:date>2015-10-14T12:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: Count if id has at least one entry in following three Months</title>
      <link>https://community.qlik.com/t5/QlikView/Count-if-id-has-at-least-one-entry-in-following-three-Months/m-p/974784#M333295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sorry,&lt;/P&gt;&lt;P&gt;i didn´t get it working &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Oct 2015 14:33:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-if-id-has-at-least-one-entry-in-following-three-Months/m-p/974784#M333295</guid>
      <dc:creator />
      <dc:date>2015-10-16T14:33:17Z</dc:date>
    </item>
  </channel>
</rss>

