<?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 based on Date in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545180#M482622</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;maybe try this in loadscript:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date(Date#(DATEFIELD, 'YYYY-MM-DD'), '&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;MM/DD/YYYY&lt;/SPAN&gt;') as NEWDATENAME&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and replace DATEFIELD and NEWDATENAME with your fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe you want beginning of week for each date too, then do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date(Weekstart(Date#(DATEFIELD, 'YYYY-MM-DD')), '&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;MM/DD/YYYY&lt;/SPAN&gt;') as NEWWEEKSTARTNAME&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;and replace DATEFIELD and NEWWEEKSTARTNAME with your fields.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Then in the expression, do:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;=Count({&amp;lt;NEWWEEKSTARTNAME = {"&amp;lt;$(=weekstart(today())), &amp;gt;=$(=weekstart(today()-7))"}&amp;gt;}[OwnerID])&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Aug 2013 14:28:33 GMT</pubDate>
    <dc:creator>jerem1234</dc:creator>
    <dc:date>2013-08-01T14:28:33Z</dc:date>
    <item>
      <title>Count based on Date</title>
      <link>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545170#M482612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to wirte an expression that does a count on the field [OwnerID] where the field [Date Termed] falls between the current_date and current_date -7 days.&amp;nbsp; Ideally I would like if it just did a count on [ownerID] for the prior week.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 13:17:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545170#M482612</guid>
      <dc:creator />
      <dc:date>2013-07-31T13:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: Count based on Date</title>
      <link>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545171#M482613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried something like this to start, but no luck&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;date&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Date Termed]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;,'MM/DD/YYYY') &amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;today&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(), &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Count&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[OwnerID]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),0) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 14:01:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545171#M482613</guid>
      <dc:creator />
      <dc:date>2013-07-31T14:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: Count based on Date</title>
      <link>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545172#M482614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Count({&amp;lt;[Date Termed]={"&amp;lt;$(=today()), &amp;gt;$(=today()-7)"}&amp;gt;}[OwnerID])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just make sure [Date Termed] is already in date format&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 15:45:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545172#M482614</guid>
      <dc:creator>jerem1234</dc:creator>
      <dc:date>2013-07-31T15:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Count based on Date</title>
      <link>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545173#M482615</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would make sure [Date Termed] is in date format in the script correct?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 15:49:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545173#M482615</guid>
      <dc:creator />
      <dc:date>2013-07-31T15:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: Count based on Date</title>
      <link>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545174#M482616</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yep thats correct, you can use the date() function to do that&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 15:51:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545174#M482616</guid>
      <dc:creator>jerem1234</dc:creator>
      <dc:date>2013-07-31T15:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: Count based on Date</title>
      <link>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545175#M482617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-family: &amp;amp;quot;Calibri&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; font-size: 11pt;"&gt;I tried using the following code, but the script does not&lt;BR /&gt;compile it.&amp;nbsp; It’s telling me it&amp;nbsp; cannot find the field &amp;lt;MM&amp;gt;,&lt;BR /&gt;thoughts?&amp;nbsp; It looks like I have syntax correct.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d; font-family: &amp;amp;quot;Calibri&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 12pt;"&gt;&lt;SPAN style="color: blue; font-family: &amp;amp;quot;Courier New&amp;amp;quot;; font-size: 9pt;"&gt;date&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: &amp;amp;quot;Courier New&amp;amp;quot;; font-size: 9pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: &amp;amp;quot;Courier New&amp;amp;quot;; font-size: 9pt;"&gt;[Date Hired]&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: &amp;amp;quot;Courier New&amp;amp;quot;; font-size: 9pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: &amp;amp;quot;Courier New&amp;amp;quot;; font-size: 9pt;"&gt;MM&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: &amp;amp;quot;Courier New&amp;amp;quot;; font-size: 9pt;"&gt;/&lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: &amp;amp;quot;Courier New&amp;amp;quot;; font-size: 9pt;"&gt;DD&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: &amp;amp;quot;Courier New&amp;amp;quot;; font-size: 9pt;"&gt;/&lt;/SPAN&gt;&lt;SPAN style="color: maroon; font-family: &amp;amp;quot;Courier New&amp;amp;quot;; font-size: 9pt;"&gt;YYYY&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: &amp;amp;quot;Courier New&amp;amp;quot;; font-size: 9pt;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: &amp;amp;quot;Courier New&amp;amp;quot;; font-size: 9pt;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: maroon; font-family: &amp;amp;quot;Courier New&amp;amp;quot;; font-size: 9pt;"&gt;[Date Hired]&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: &amp;amp;quot;Courier New&amp;amp;quot;; font-size: 9pt;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 16:08:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545175#M482617</guid>
      <dc:creator />
      <dc:date>2013-07-31T16:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: Count based on Date</title>
      <link>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545176#M482618</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;added single quotes to the format 'mm/dd/yyyy' and everything seems ok.&amp;nbsp; that correct?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 16:13:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545176#M482618</guid>
      <dc:creator />
      <dc:date>2013-07-31T16:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: Count based on Date</title>
      <link>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545177#M482619</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i tried that code, but no luck.&amp;nbsp; I am returning a value of 0.&amp;nbsp; I also tried updating the days to look back to -100 and still nothing.&amp;nbsp; I am certain I had users term within the past 100 days.&amp;nbsp; Would it be any easier if i just needed the count for the previous week.&amp;nbsp; Maybe use the InWeek() function?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 16:22:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545177#M482619</guid>
      <dc:creator />
      <dc:date>2013-07-31T16:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: Count based on Date</title>
      <link>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545178#M482620</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your data was in like a text format or a number format like 20130731 you'll have to use something like date#(FIELD, 'YYYYMMDD'). and then you can use date(date#(FIELD, 'YYYYMMDD'), 'MM/DD/YYYY') to get it in the format you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to get previous week, you could do something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=if(weekstart([Date Termed]) = weekstart(today()-7), Count([OwnerID]), Null())&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=if(weekstart(date#([Date Termed], 'FORMAT')) = weekstart(today()-7), Count([OwnerID]), Null())&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where FORMAT is whatever format your data originally is when you are loading it in.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 17:26:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545178#M482620</guid>
      <dc:creator>jerem1234</dc:creator>
      <dc:date>2013-07-31T17:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: Count based on Date</title>
      <link>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545179#M482621</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The dates are coming into the system in the following format yyyy-mm-dd, for example 213-007-23&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 19:48:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545179#M482621</guid>
      <dc:creator />
      <dc:date>2013-07-31T19:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: Count based on Date</title>
      <link>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545180#M482622</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;maybe try this in loadscript:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date(Date#(DATEFIELD, 'YYYY-MM-DD'), '&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;MM/DD/YYYY&lt;/SPAN&gt;') as NEWDATENAME&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and replace DATEFIELD and NEWDATENAME with your fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe you want beginning of week for each date too, then do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date(Weekstart(Date#(DATEFIELD, 'YYYY-MM-DD')), '&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;MM/DD/YYYY&lt;/SPAN&gt;') as NEWWEEKSTARTNAME&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;and replace DATEFIELD and NEWWEEKSTARTNAME with your fields.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Then in the expression, do:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;=Count({&amp;lt;NEWWEEKSTARTNAME = {"&amp;lt;$(=weekstart(today())), &amp;gt;=$(=weekstart(today()-7))"}&amp;gt;}[OwnerID])&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Aug 2013 14:28:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-based-on-Date/m-p/545180#M482622</guid>
      <dc:creator>jerem1234</dc:creator>
      <dc:date>2013-08-01T14:28:33Z</dc:date>
    </item>
  </channel>
</rss>

