<?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: Max timestamp in expression with if statement in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Max-timestamp-in-expression-with-if-statement/m-p/516750#M1141079</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe just do a DISTINCT count?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;COUNT&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(DISTINCT &lt;/SPAN&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;FABS&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;((&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: #800000; font-size: 8pt;"&gt;HISTORY_UPDATE_DATE&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &amp;lt; 1, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;REQUEST_ID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;or another possibility might be:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=sum( aggr( if( fabs(Today()-max(HISTORY_UPDATE_DATE)&amp;lt;1,1), REQUEST_ID))&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Sep 2013 15:20:28 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2013-09-12T15:20:28Z</dc:date>
    <item>
      <title>Max timestamp in expression with if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Max-timestamp-in-expression-with-if-statement/m-p/516749#M1141078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've looked around the community for an answer to this but nothing's worked that I've tried for my particular situation. I need this expression in a chart, but since there's multiple HISTORY_UPDATE_DATE timestamps per REQUEST_ID I have to grab the maximum value (most recent) HISTORY_UPDATE_DATE.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;=&lt;SPAN style="font-size: 8pt;"&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: #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;FABS&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;((&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: #800000; font-size: 8pt;"&gt;HISTORY_UPDATE_DATE&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &amp;lt; 1, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;REQUEST_ID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;Any suggestions?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2013 15:13:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Max-timestamp-in-expression-with-if-statement/m-p/516749#M1141078</guid>
      <dc:creator />
      <dc:date>2013-09-12T15:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: Max timestamp in expression with if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Max-timestamp-in-expression-with-if-statement/m-p/516750#M1141079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe just do a DISTINCT count?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;COUNT&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(DISTINCT &lt;/SPAN&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;FABS&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;((&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: #800000; font-size: 8pt;"&gt;HISTORY_UPDATE_DATE&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &amp;lt; 1, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;REQUEST_ID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;or another possibility might be:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=sum( aggr( if( fabs(Today()-max(HISTORY_UPDATE_DATE)&amp;lt;1,1), REQUEST_ID))&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2013 15:20:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Max-timestamp-in-expression-with-if-statement/m-p/516750#M1141079</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-09-12T15:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: Max timestamp in expression with if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Max-timestamp-in-expression-with-if-statement/m-p/516751#M1141080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe&lt;/P&gt;&lt;P&gt;Count( If(HISTORY_UPDATE_DATE=Max(total HISTORY_UPDATE_DATE), REQUEST_ID))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2013 17:15:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Max-timestamp-in-expression-with-if-statement/m-p/516751#M1141080</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2013-09-12T17:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Max timestamp in expression with if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Max-timestamp-in-expression-with-if-statement/m-p/516752#M1141081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The distinct count didn't narrow down the data to one timestamp oddly enough, and there seems to be a syntax error with the aggregation option. I've attached some sample data if it helps. To further explain what I have to do - I need to get counts of all of REQUEST_IDs whose most recent timestamp is less than 1 day, between 1 &amp;amp; 3 days, and more than 3 days. Any other info needed, I'll be happy to supply.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2013 19:16:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Max-timestamp-in-expression-with-if-statement/m-p/516752#M1141081</guid>
      <dc:creator />
      <dc:date>2013-09-12T19:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Max timestamp in expression with if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Max-timestamp-in-expression-with-if-statement/m-p/516753#M1141082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need the &amp;lt;1 part in there as a comparison function. I tried a modified version of what you suggested, but neither your original or this modified versin worked:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;=&lt;SPAN style="font-size: 12pt;"&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt;"&gt;Count&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt;"&gt;( &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt;"&gt;If&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt;"&gt;Today&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt;"&gt;()-(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 12pt;"&gt;HISTORY_UPDATE_DATE&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt;"&gt;Max&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt;"&gt;total&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 12pt;"&gt;HISTORY_UPDATE_DATE&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt;"&gt;)) &amp;lt; 1, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 12pt;"&gt;REQUEST_ID&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt;"&gt;)) &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2013 19:20:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Max-timestamp-in-expression-with-if-statement/m-p/516753#M1141082</guid>
      <dc:creator />
      <dc:date>2013-09-12T19:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Max timestamp in expression with if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Max-timestamp-in-expression-with-if-statement/m-p/516754#M1141083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The expression &lt;SPAN style="font-size: 12pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #800000;"&gt;HISTORY_UPDATE_DATE&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #0000ff;"&gt;Max&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #0000ff;"&gt;total&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #800000;"&gt;HISTORY_UPDATE_DATE&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;)&lt;/SPAN&gt; does the necessary comparison, or ...? So, I don't understand why you need an additional relational operator.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2013 19:38:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Max-timestamp-in-expression-with-if-statement/m-p/516754#M1141083</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2013-09-12T19:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Re: Max timestamp in expression with if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Max-timestamp-in-expression-with-if-statement/m-p/516755#M1141084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;The distinct count didn't narrow down the data to one timestamp oddly enough, and there seems to be a syntax error with the aggregation option. I've attached some sample data if it helps. To further explain what I have to do - I need to get counts of all of REQUEST_IDs whose most recent timestamp is less than 1 day, between 1 &amp;amp; 3 days, and more than 3 days. Any other info needed, I'll be happy to supply.&lt;/P&gt;

&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;What do you expect as result?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assumed you want to get a distinct count of the REQUEST_ID with a max HISTORY_UPDATE within a certain distance from today.&lt;/P&gt;&lt;P&gt;You posted a sample with three distinct REQUEST_ID, so the answer should be 0,1,2 or 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking at your data, two REQUEST_IDs 784445 and 784596 have a maximum HISTORY_UPDATE_DATE within 1 day from today, so should be counted -- answer is 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using my first expression with the DISTINCT qualifier, I do get these two IDs counted.&lt;/P&gt;&lt;P&gt;Using my second expression, after adding the missing closing bracket, I also get a count of 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again, what do you expect to see when using your sample data?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2013 22:45:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Max-timestamp-in-expression-with-if-statement/m-p/516755#M1141084</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-09-12T22:45:47Z</dc:date>
    </item>
  </channel>
</rss>

