<?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 Count of Records Between two dates in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241862#M92254</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Miguel,&lt;/P&gt;&lt;P&gt;Where it's 'Count' in the expression, do I need to change this for the field I need to count - tr_lot?&lt;/P&gt;&lt;P&gt;I've tried pasting what you have above directly into my sheet but no joy!&lt;/P&gt;&lt;P&gt;Many thanks for your continued help,&lt;BR /&gt;Kind Regards,&lt;BR /&gt;Dayna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Mar 2011 16:06:34 GMT</pubDate>
    <dc:creator>Dayna</dc:creator>
    <dc:date>2011-03-08T16:06:34Z</dc:date>
    <item>
      <title>Count of Records Between two dates</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241858#M92250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;I have a table that shows the date for the record and the previous date (i.e. Date From - 01/01/2011 Date To - 10/01/2011) for everythign with 'Type A'. I would like to show on this row the number of records that fall between Date From and Date To. Now, the issue I have is I want to count all the records that are of Type B.&lt;/P&gt;&lt;P&gt;I'm using a simple Set Analysis expression to calculate my amount:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;tr_type = {'CYC-RCNT'}&amp;gt;} tr_qty_loc)&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;And to get the previous date I'm using this in the load script..&lt;/P&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;&lt;P style="font-weight: bold"&gt;If(tr_part = Previous(tr_part), date(previous(tr_effdate)), 'N/A') AS tr_DateFrom,&lt;/P&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried an IF statement (If greater than date and less than, then count (Field1)) but this doesn't work!&lt;/P&gt;&lt;P&gt;I hope you can help me!&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;BR /&gt;Dayna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2011 14:06:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241858#M92250</guid>
      <dc:creator>Dayna</dc:creator>
      <dc:date>2011-03-08T14:06:34Z</dc:date>
    </item>
    <item>
      <title>Count of Records Between two dates</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241859#M92251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Dayna,&lt;/P&gt;&lt;P&gt;If I understand correctly you want to know how many records are between one date and another. I'd do that in the script, according to my previous one, using something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;If(Product = Previous(Product), RangeSum(Peek('Count'), 1), 1) AS Count,&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Then, you will need to use instead the Max(Count) per dimension (Product, in your example), since all records will have a value for "Count" (1, 2, 3, etc)&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2011 14:28:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241859#M92251</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-03-08T14:28:36Z</dc:date>
    </item>
    <item>
      <title>Count of Records Between two dates</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241860#M92252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Migual,&lt;/P&gt;&lt;P&gt;Thank you for your response, it is indeed in reference to your last post which I've amended to do the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(tr_part = Previous(tr_part) &lt;B&gt;AND&lt;/B&gt; tr_type = 'CYC-RCNT', date(previous(tr_effdate)), 'N/A') &lt;B&gt;AS&lt;/B&gt; tr_DateFrom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;Could you explain what you mean by the latter of your post? I've never really used RangeSum or Peek.. The field I'm trying to count is everything for tr_type = ISS-WO and the field is tr_lot. &lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Kind Regards,&lt;BR /&gt;Dayna&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2011 15:13:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241860#M92252</guid>
      <dc:creator>Dayna</dc:creator>
      <dc:date>2011-03-08T15:13:50Z</dc:date>
    </item>
    <item>
      <title>Count of Records Between two dates</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241861#M92253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Dayna,&lt;/P&gt;&lt;P&gt;Something like the following (not sure about your field names and so):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;DataWithPreviousDate:LOAD Product, Date AS DateTo, If(tr_part = Previous(tr_part) AND tr_type = 'CYC-RCNT', Date(Previous(tr_effdate)), 'N/A') AS tr_DateFrom, If(tr_part = Previous(tr_part) AND tr_type = 'ISS-WO', RangeSum(Peek('IISWOCount'), 1), 1) AS IISWOCount, AmountRESIDENT OriginalDataORDER BY Product, Date;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Hope that makes sense.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2011 15:20:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241861#M92253</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-03-08T15:20:53Z</dc:date>
    </item>
    <item>
      <title>Count of Records Between two dates</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241862#M92254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Miguel,&lt;/P&gt;&lt;P&gt;Where it's 'Count' in the expression, do I need to change this for the field I need to count - tr_lot?&lt;/P&gt;&lt;P&gt;I've tried pasting what you have above directly into my sheet but no joy!&lt;/P&gt;&lt;P&gt;Many thanks for your continued help,&lt;BR /&gt;Kind Regards,&lt;BR /&gt;Dayna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2011 16:06:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241862#M92254</guid>
      <dc:creator>Dayna</dc:creator>
      <dc:date>2011-03-08T16:06:34Z</dc:date>
    </item>
    <item>
      <title>Count of Records Between two dates</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241863#M92255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Again, my fault, I missed the fieldname there. Let's take a look at the new field we are creating:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;If(tr_part = Previous(tr_part) AND tr_type = 'ISS-WO', RangeSum(Peek('ISSWOCount'), 1), 1) AS ISSWOCount&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;It will read "if the value in tr_part of the current record equals to the value for tr_part in the previous record, and tr-typr equals to 'ISS-WO', then add 1 to the last value in field ISSWOCount, otherwise set it to 1".&lt;/P&gt;&lt;P&gt;Peek() in this case returns the last value in a field ISSWOCount. RangeSum() just adds 1 to the current value of ISSWOCount for a given record.&lt;/P&gt;&lt;P&gt;It's not counting anything, actually, rather than creating a counter (as such will store from 1 to all possible values in the field). Assume that tr_part has 3 records where tr_type equals to 'ISS-WO'. ISSWOCount will have values 1, 2 and 3. Using Max(ISSWOCount) will return how many records are. Doing this in the script will save time and complexity in the expressions part in the charts.&lt;/P&gt;&lt;P&gt;I've attached a very simple example based on your post so you get the counter in this way for each product.&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2011 16:28:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241863#M92255</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-03-08T16:28:26Z</dc:date>
    </item>
    <item>
      <title>Count of Records Between two dates</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241864#M92256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Miguel,&lt;/P&gt;&lt;P&gt;Your very helpful, thank you for all your effort in the above.. I can see exactly what you mean, as it'll give me a count of ISS-WO per product.&lt;/P&gt;&lt;P&gt;For my next question, will the above be smart enough to give me a value for how many ISS-WO's there are between Data From and To for a CYC-RCNT?&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;BR /&gt;Dayna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2011 16:53:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241864#M92256</guid>
      <dc:creator>Dayna</dc:creator>
      <dc:date>2011-03-08T16:53:40Z</dc:date>
    </item>
    <item>
      <title>Count of Records Between two dates</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241865#M92257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It should be enough changing the field for the value you are actually looking for:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;If(tr_part = Previous(tr_part) AND tr_type = 'CYC-RCNT', RangeSum(Peek('Count'), 1), 1) AS Count,&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Is that correct?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2011 16:57:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241865#M92257</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-03-08T16:57:39Z</dc:date>
    </item>
    <item>
      <title>Count of Records Between two dates</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241866#M92258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I will certainly give it a go! Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Mar 2011 17:20:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241866#M92258</guid>
      <dc:creator>Dayna</dc:creator>
      <dc:date>2011-03-08T17:20:56Z</dc:date>
    </item>
    <item>
      <title>Count of Records Between two dates</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241867#M92259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Miguel,&lt;/P&gt;&lt;P&gt;The figures still don't work, I've attached what I currently have.. The best example is one of the last records, where the Date From and Date To for the CYC-RCNT's is 01/03 - 06/03. In the other table, I can see there's 6 ISS-WO entries between these dates...&lt;/P&gt;&lt;P&gt;I hope you can help!&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;BR /&gt;Dayna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Mar 2011 10:25:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241867#M92259</guid>
      <dc:creator>Dayna</dc:creator>
      <dc:date>2011-03-09T10:25:21Z</dc:date>
    </item>
    <item>
      <title>Count of Records Between two dates</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241868#M92260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Dayna,&lt;/P&gt;&lt;P&gt;Still don't understand where the issue is, because I don't know which values are correct and which are not., but I've seen that in the orange table you are not using the counter you just created in the script. So replace the expression "IISWOCount" for&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Max(ISSWOCount)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Additionally, you can add the expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Count({&amp;lt; tr_type = {'ISS-WO'} &amp;gt;} tr_lot)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;that will return the number of values for "tr_lot" (not distinct) and see whether that starts to make sense.&lt;/P&gt;&lt;P&gt;Anyway, I'll keep doing that part in the script, but I'm not sure of the criteria. My guess is that you are looking for "count the number of tr_lot values between CYC-RCNT records". Following that RangeSum (or RangeCount) and Peek approach will do.&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Mar 2011 14:45:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241868#M92260</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-03-09T14:45:08Z</dc:date>
    </item>
    <item>
      <title>Count of Records Between two dates</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241869#M92261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Miguel,&lt;/P&gt;&lt;P&gt;Yes, it's 'count the number of ISS-WO between the CYC-RCNT records', I had disabled the max(ISSWOCount) which brings the below.. But the value should be on the same row as the date from and to for the CYC-RCNT (Not show the ISS-WO records).&lt;/P&gt;&lt;P&gt;So really, the value for row 01/03 - 06/03 should be 4 according to the other table.&lt;/P&gt;&lt;P&gt;Hope this makes sense?&lt;/P&gt;&lt;P&gt;Many thanks,&lt;BR /&gt;Dayna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Mar 2011 15:06:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241869#M92261</guid>
      <dc:creator>Dayna</dc:creator>
      <dc:date>2011-03-09T15:06:18Z</dc:date>
    </item>
    <item>
      <title>Count of Records Between two dates</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241870#M92262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Dayna,&lt;/P&gt;&lt;P&gt;As I cannot reload, I'll try to make some dummy data than can be helpful to what you are looking for.&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Mar 2011 15:53:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241870#M92262</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-03-09T15:53:03Z</dc:date>
    </item>
    <item>
      <title>Count of Records Between two dates</title>
      <link>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241871#M92263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Miguel,&lt;/P&gt;&lt;P&gt;Please find attached a QVD of that data, hope this helps!&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;BR /&gt;Dayna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Mar 2011 15:56:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-of-Records-Between-two-dates/m-p/241871#M92263</guid>
      <dc:creator>Dayna</dc:creator>
      <dc:date>2011-03-09T15:56:04Z</dc:date>
    </item>
  </channel>
</rss>

