<?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: Cache hit ratio - Flag in script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Cache-hit-ratio-Flag-in-script/m-p/1091443#M638228</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I see what you mean Stefan. I think you are right, but can we simplify the code a little by using Left Join with Min value for timestamp?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD [Unique scenario(Key)], &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Request (timestamp)]&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;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;A class="jive-link-thread-small" data-containerid="2061" data-containertype="14" data-objectid="214323" data-objecttype="1" href="https://community.qlik.com/thread/214323"&gt;https://community.qlik.com/thread/214323&lt;/A&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(html, codepage is 1252, embedded labels, table is @1);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Join (Table)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD [Unique scenario(Key)], &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Min([Request (timestamp)]) as Min&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Group By [Unique scenario(Key)];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FinalTable:&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([Request (timestamp)] - Min &amp;gt; 0 and [Request (timestamp)] - Min &amp;lt; MakeTime(0, 30), 'True', 'False') as Flag&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Order By [Unique scenario(Key)], [Request (timestamp)];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP Table Table;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 24 Apr 2016 01:28:36 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2016-04-24T01:28:36Z</dc:date>
    <item>
      <title>Cache hit ratio - Flag in script</title>
      <link>https://community.qlik.com/t5/QlikView/Cache-hit-ratio-Flag-in-script/m-p/1091437#M638222</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;I need to calculate the cache hit ratio. &lt;/P&gt;&lt;P&gt;Cache hit ratio is calculated as: &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;number of searches that hit cache / total searches&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;To do so i need to create a flag in the table with true and false indication.&lt;/P&gt;&lt;P&gt;The system cache first response per unique scenario for 30 minutes.&lt;/P&gt;&lt;P&gt;If a request is made for the same unique &lt;SPAN style="font-size: 13.3333px;"&gt;scenario &lt;/SPAN&gt;within 30 minutes the system serves the results from cache.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My original table has these data:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="324" style="border: 1px solid rgb(0, 0, 0); width: 301px; height: 324px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Unique scenario(Key)&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Request (timestamp)&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2016-04-19 06:23:39&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 06:23:39&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 06:23:50&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 06:24:20&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 06:24:50&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 06:35:19&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 07:13:05&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 08:59:39&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 06:28:39&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 06:33:50&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 06:39:50&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 07:33:50&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Modified table should look like this:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="328" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#000000&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;,&amp;quot;verticalAlign&amp;quot;:&amp;quot;baseline&amp;quot;}" style="border: 1px solid rgb(0, 0, 0); width: 348px; height: 330px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Unique scenario(Key)&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Request (timestamp)&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Flag&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2016-04-19 06:23:39&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;False&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 06:23:39&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;True&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 06:23:50&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;True&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 06:24:20&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;True&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 06:24:50&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;True&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 06:35:19&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;True&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 07:13:05&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;False&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 08:59:39&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;False&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 06:28:39&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;False&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 06:33:50&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;True&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 06:39:50&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;True&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;2016-04-19 07:33:50&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;False&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;I want to do this in script as my table consists of millions of records.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Can anyone help?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Apr 2016 12:11:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cache-hit-ratio-Flag-in-script/m-p/1091437#M638222</guid>
      <dc:creator />
      <dc:date>2016-04-23T12:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: Cache hit ratio - Flag in script</title>
      <link>https://community.qlik.com/t5/QlikView/Cache-hit-ratio-Flag-in-script/m-p/1091438#M638223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not entirely sure how you are getting the output you specified, would you be able to elaborate?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Apr 2016 14:15:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cache-hit-ratio-Flag-in-script/m-p/1091438#M638223</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-04-23T14:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: Cache hit ratio - Flag in script</title>
      <link>https://community.qlik.com/t5/QlikView/Cache-hit-ratio-Flag-in-script/m-p/1091439#M638224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Got it, may be this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD [Unique scenario(Key)], &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Request (timestamp)]&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;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;A _jive_internal="true" data-containerid="2061" data-containertype="14" data-objectid="214323" data-objecttype="1" href="https://community.qlik.com/thread/214323"&gt;https://community.qlik.com/thread/214323&lt;/A&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(html, codepage is 1252, embedded labels, table is @1);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FinalTable:&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([Unique scenario(Key)] = Peek('Unique scenario(Key)'), If([Request (timestamp)] - Peek('Request (timestamp)') &amp;lt;= MakeTime(0, 30), 'True', 'False'), 'False') as Flag&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Order By [Unique scenario(Key)], [Request (timestamp)];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP Table Table;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/122535_Capture.PNG" style="height: auto;" /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Apr 2016 14:21:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cache-hit-ratio-Flag-in-script/m-p/1091439#M638224</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-04-23T14:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: Cache hit ratio - Flag in script</title>
      <link>https://community.qlik.com/t5/QlikView/Cache-hit-ratio-Flag-in-script/m-p/1091440#M638225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Sunny T&lt;/P&gt;&lt;P&gt;The table is order by Unique Key asc, created_at asc.&lt;/P&gt;&lt;P&gt;The first row represents the first request. This gets a false value as it is not cached by the system.&lt;/P&gt;&lt;P&gt;The next 5 records have true value as they are within 30 minutes from the 1st record and are served from the system cache.&lt;/P&gt;&lt;P&gt;Then a new request is made (record 7) and is not served from the system cache (the time frame of 30 minutes has passed).&lt;/P&gt;&lt;P&gt;The same applies and for the 8th record. Thats why they will get false value.&lt;/P&gt;&lt;P&gt;If record 8 was within 30 minutes from record 7, then the flag should be true.&lt;/P&gt;&lt;P&gt;The same logic is repeated in the rest of the records but for different unique key.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Apr 2016 14:32:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cache-hit-ratio-Flag-in-script/m-p/1091440#M638225</guid>
      <dc:creator />
      <dc:date>2016-04-23T14:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: Cache hit ratio - Flag in script</title>
      <link>https://community.qlik.com/t5/QlikView/Cache-hit-ratio-Flag-in-script/m-p/1091441#M638226</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you got time to look at the solution I proposed? It matches the output you were looking for.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Apr 2016 20:23:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cache-hit-ratio-Flag-in-script/m-p/1091441#M638226</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-04-23T20:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: Cache hit ratio - Flag in script</title>
      <link>https://community.qlik.com/t5/QlikView/Cache-hit-ratio-Flag-in-script/m-p/1091442#M638227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Theofilas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've read your requirements a bit different than Sunny:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;The table is order by Unique Key asc, created_at asc.&lt;/P&gt;
&lt;P&gt;The first row represents the first request. This gets a false value as it is not cached by the system.&lt;/P&gt;
&lt;P&gt;The next 5 records have true value as they &lt;STRONG&gt;are within 30 minutes from the 1st record&lt;/STRONG&gt; and are served from the system cache.&lt;/P&gt;
&lt;P&gt;Then a new request is made (record 7) and is not served from the system cache (the time frame of 30 minutes has passed).&lt;/P&gt;
&lt;P&gt;The same applies and for the 8th record. Thats why they will get false value.&lt;/P&gt;
&lt;P&gt;If record 8 was within 30 minutes from record 7, then the flag should be true.&lt;/P&gt;
&lt;P&gt;The same logic is repeated in the rest of the records but for different unique key.&lt;/P&gt;

&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;If I understood correctly, the 30 minutes starts ticking from the time the cache entry is created and is not reset with every new request that can be answered from the cache.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14614492231915080" jivemacro_uid="_14614492231915080"&gt;
&lt;P&gt;Table:&lt;/P&gt;
&lt;P&gt;LOAD [Unique scenario(Key)], &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Request (timestamp)]&lt;/P&gt;
&lt;P&gt;FROM&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;A class="jive-link-thread-small" data-containerid="2061" data-containertype="14" data-objectid="214323" data-objecttype="1" href="https://community.qlik.com/thread/214323"&gt;https://community.qlik.com/thread/214323&lt;/A&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;(html, codepage is 1252, embedded labels, table is @1);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;FinalTable:&lt;/P&gt;
&lt;P&gt;LOAD *,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; If([Unique scenario(Key)] = Previous([Unique scenario(Key)]) &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; and ([Request (timestamp)] -&amp;nbsp; Alt(Peek('CacheTime'),[Request (timestamp)])) &amp;lt;= MakeTime(0,30),&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Peek('CacheTime') , &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Request (timestamp)] ) as CacheTime,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; If([Unique scenario(Key)] = Peek('Unique scenario(Key)'), &lt;/P&gt;
&lt;P&gt;&amp;nbsp; If([Request (timestamp)] - Peek('CacheTime') &amp;lt;= MakeTime(0, 30), 'True', 'False'),'False') as Flag&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Resident Table&lt;/P&gt;
&lt;P&gt;Order By [Unique scenario(Key)], [Request (timestamp)];&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;DROP Table Table;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="2016-04-24 00_07_14-QlikView x64 - [C__Users_Stefan_Downloads_comm214323.qvw].png" class="jive-image image-1" src="/legacyfs/online/122539_2016-04-24 00_07_14-QlikView x64 - [C__Users_Stefan_Downloads_comm214323.qvw].png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You won't see a difference between my version and Sunny's version given your sample records, but you should see a difference e.g. when the requests come in every 29 minutes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Apr 2016 22:10:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cache-hit-ratio-Flag-in-script/m-p/1091442#M638227</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-04-23T22:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: Cache hit ratio - Flag in script</title>
      <link>https://community.qlik.com/t5/QlikView/Cache-hit-ratio-Flag-in-script/m-p/1091443#M638228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I see what you mean Stefan. I think you are right, but can we simplify the code a little by using Left Join with Min value for timestamp?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD [Unique scenario(Key)], &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Request (timestamp)]&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;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;A class="jive-link-thread-small" data-containerid="2061" data-containertype="14" data-objectid="214323" data-objecttype="1" href="https://community.qlik.com/thread/214323"&gt;https://community.qlik.com/thread/214323&lt;/A&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(html, codepage is 1252, embedded labels, table is @1);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Join (Table)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD [Unique scenario(Key)], &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Min([Request (timestamp)]) as Min&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Group By [Unique scenario(Key)];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FinalTable:&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([Request (timestamp)] - Min &amp;gt; 0 and [Request (timestamp)] - Min &amp;lt; MakeTime(0, 30), 'True', 'False') as Flag&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Order By [Unique scenario(Key)], [Request (timestamp)];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP Table Table;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 24 Apr 2016 01:28:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cache-hit-ratio-Flag-in-script/m-p/1091443#M638228</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-04-24T01:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: Cache hit ratio - Flag in script</title>
      <link>https://community.qlik.com/t5/QlikView/Cache-hit-ratio-Flag-in-script/m-p/1091444#M638229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to thank you all (Sunny T and swuehl).&lt;/P&gt;&lt;P&gt;@ swuehl&lt;/P&gt;&lt;P&gt;The solution you provided is the correct and it works.&lt;/P&gt;&lt;P&gt;If you have the time, is it possible to explain what you have done? &lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 24 Apr 2016 06:58:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cache-hit-ratio-Flag-in-script/m-p/1091444#M638229</guid>
      <dc:creator />
      <dc:date>2016-04-24T06:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: Cache hit ratio - Flag in script</title>
      <link>https://community.qlik.com/t5/QlikView/Cache-hit-ratio-Flag-in-script/m-p/1091445#M638230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sunny, I don't think that these scripts are equivalent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Look at the second record, it is now flagged as False instead of True.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And all requests for a scenario that come in after 30 mins after the very first are now flagged as False, while I think a caching should happen instead again.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"If record 8 was within 30 minutes from record 7, then the flag should be true."&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should see the difference clearly by adding some more sample records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 24 Apr 2016 10:27:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cache-hit-ratio-Flag-in-script/m-p/1091445#M638230</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-04-24T10:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: Cache hit ratio - Flag in script</title>
      <link>https://community.qlik.com/t5/QlikView/Cache-hit-ratio-Flag-in-script/m-p/1091446#M638231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I see what you mean. Everytime a request is made, the things will be in Cache for next 30 mins and then as soon as it passes the 30 minutes limit the flag becomes False and then for the next 30 it again become true??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stefan, I am learning, I will be there one day (with your help) &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&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>Sun, 24 Apr 2016 16:03:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Cache-hit-ratio-Flag-in-script/m-p/1091446#M638231</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-04-24T16:03:59Z</dc:date>
    </item>
  </channel>
</rss>

