<?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 items with max date in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Count-items-with-max-date/m-p/292302#M108495</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #000000; font-family: arial, sans-serif; font-size: 12.8px;"&gt;&lt;SPAN style="font-size: 11pt; font-family: Calibri, sans-serif;"&gt;Hello Miguel Angel,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #000000; font-family: arial, sans-serif; font-size: 12.8px;"&gt;&lt;SPAN style="font-size: 11pt; font-family: Calibri, sans-serif;"&gt;I am using the following formula:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #000000; font-family: arial, sans-serif; font-size: 12.8px;"&gt;&lt;SPAN style="font-size: 11pt; font-family: Calibri, sans-serif;"&gt;sum (If (Aggr (NODISTINCT max (Date), Local_Id, SKU) = Date, Value))&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #000000; font-family: arial, sans-serif; font-size: 12.8px;"&gt;&lt;SPAN style="font-size: 11pt; font-family: Calibri, sans-serif;"&gt;Which works perfect for the last date of the model. The problem is that when filtering by any date, the formula does not work in the same way.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #000000; font-family: arial, sans-serif; font-size: 12.8px;"&gt;&lt;SPAN style="font-size: 11pt; font-family: Calibri, sans-serif;"&gt;Is there any way to leave it running in order to use the Date as a dynamic field?&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #000000; font-family: arial, sans-serif; font-size: 12.8px;"&gt;&lt;SPAN style="font-size: 11pt; font-family: Calibri, sans-serif;"&gt;thank you very much&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Jan 2018 18:45:34 GMT</pubDate>
    <dc:creator>nerrazuriz</dc:creator>
    <dc:date>2018-01-24T18:45:34Z</dc:date>
    <item>
      <title>Count items with max date</title>
      <link>https://community.qlik.com/t5/QlikView/Count-items-with-max-date/m-p/292293#M108486</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;Can't figure out this simple problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATES:&lt;BR /&gt;LOAD id, Date#(date) as date, status INLINE [&lt;BR /&gt;id, date, status&lt;BR /&gt;1, 1/1/2011, Rejected&lt;BR /&gt;1, 2/2/2011, Approved&lt;BR /&gt;2, 3/3/2011, Rejected&lt;BR /&gt;3, 4/4/2011, Approved];&lt;/P&gt;&lt;P&gt;I'm trying to create an expression to:&lt;/P&gt;&lt;P&gt;- count rows where date is max(date) for that id&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I Know I can do it with a simple count distinct, but just because I'm curious I'm trying to get it to work with: &lt;/P&gt;&lt;P&gt;Count( {$&amp;lt;date={$(=max(date))}&amp;gt;} id ) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and somehow this doesn't work. But if I similarly do: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count( {$&amp;lt;id={$(=min(id))}&amp;gt;} id ) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it works fine. I already noticed that dates get transformed into numbers, but cant get the expresion with date right. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards Jeroen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2011 19:13:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-items-with-max-date/m-p/292293#M108486</guid>
      <dc:creator />
      <dc:date>2011-06-15T19:13:39Z</dc:date>
    </item>
    <item>
      <title>Count items with max date</title>
      <link>https://community.qlik.com/t5/QlikView/Count-items-with-max-date/m-p/292294#M108487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;=if(date = max(total &amp;lt;id&amp;gt; date),id)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Depending on how you want to use it, you might have to use the aggr function.&amp;nbsp; That will only work in chart expressions, not the script.&amp;nbsp; You could also use the FirstSortedValue function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set analysis is calculated once per chart, not once per row so neither of those expressions you wrote are going to do what you really want (if you select one id then it will work, which is probably what happened when you tested the second).&amp;nbsp; Set analysis would be good if you wanted, say, all dates after 3/1/2011 (or something universal to every row).&amp;nbsp; Since each id has a different minimum date, you don't want set analysis.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2011 20:38:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-items-with-max-date/m-p/292294#M108487</guid>
      <dc:creator />
      <dc:date>2011-06-15T20:38:03Z</dc:date>
    </item>
    <item>
      <title>Count items with max date</title>
      <link>https://community.qlik.com/t5/QlikView/Count-items-with-max-date/m-p/292295#M108488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; hi Jeroen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;got it to work on my workstation but had to do two changes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first in the load wrapped your date#() function which interprets in a date() function which formats. I formatted it to be equal to my default date setting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET DateFormat='DD/MM/YYYY';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATES:&lt;BR /&gt;LOAD id, Date#(date) as date, &lt;BR /&gt; date(Date#(date),'DD/MM/YYYY') as date2,&lt;/P&gt;&lt;P&gt;status INLINE [&lt;/P&gt;&lt;P&gt;id, date, status&lt;/P&gt;&lt;P&gt;1, 1/1/2011, Rejected&lt;/P&gt;&lt;P&gt;1, 2/2/2011, Approved&lt;/P&gt;&lt;P&gt;2, 3/3/2011, Rejected&lt;/P&gt;&lt;P&gt;3, 4/4/2011, Approved];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then in the expression I put simple quotes round the max() expression changing the result from a number&amp;nbsp; to a string:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Count( {$&amp;lt;date2={'$(=max(date2))'}&amp;gt;} id )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does set analysis therefore require you to compare the string representation of the date? or is this always the case in qv. The date will be processed as a number when being transformed but in comparisons if not wrapped in a numeric function (num(), floor() etc.) must it be compared to a string?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know the answer to this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2011 20:41:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-items-with-max-date/m-p/292295#M108488</guid>
      <dc:creator>pat_agen</dc:creator>
      <dc:date>2011-06-15T20:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: Count items with max date</title>
      <link>https://community.qlik.com/t5/QlikView/Count-items-with-max-date/m-p/292296#M108489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Trent, thanks for explaining set analysis is calculated once per chart. I am indeed trying to evaluate each row against the highest value of the corresponding group. So that means set analysis is out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Pat, thanks for clearing up the comparison with dates. Never thought of putting the expression between quotes. Although the date comparison works, I was expecting the answer to be 3 instead of 1. That probly is caused by set analysis being calculated only once like Trent said.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So a bit wiser, but not solved yet.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2011 21:04:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-items-with-max-date/m-p/292296#M108489</guid>
      <dc:creator />
      <dc:date>2011-06-15T21:04:02Z</dc:date>
    </item>
    <item>
      <title>Count items with max date</title>
      <link>https://community.qlik.com/t5/QlikView/Count-items-with-max-date/m-p/292297#M108490</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well if you have a chart with id as the dimension you do:&lt;/P&gt;&lt;P&gt;=count(if(date = max(total &amp;lt;id&amp;gt; date), id)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure how this doens't solve your problem?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2011 21:38:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-items-with-max-date/m-p/292297#M108490</guid>
      <dc:creator />
      <dc:date>2011-06-15T21:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: Count items with max date</title>
      <link>https://community.qlik.com/t5/QlikView/Count-items-with-max-date/m-p/292298#M108491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wasn't looking for the id with the latest date, I was looking for a count of all lines with a date equal to the latest date for that item. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2011 05:33:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-items-with-max-date/m-p/292298#M108491</guid>
      <dc:creator />
      <dc:date>2011-06-16T05:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: Count items with max date</title>
      <link>https://community.qlik.com/t5/QlikView/Count-items-with-max-date/m-p/292299#M108492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Jeroen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try something like the following&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;Count(If(Aggr(NODISTINCT Max(date), id) = date, id))&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/people/mabaeyens"&gt;Miguel Angel Baeyens&lt;/A&gt;&lt;/P&gt;&lt;P&gt;BI Consultant&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.grupocomex.com"&gt;Comex Grupo Ibérica&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2011 06:41:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-items-with-max-date/m-p/292299#M108492</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-06-16T06:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: Count items with max date</title>
      <link>https://community.qlik.com/t5/QlikView/Count-items-with-max-date/m-p/292300#M108493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Great that works &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;. Why is the NODISTINCT required here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2011 06:48:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-items-with-max-date/m-p/292300#M108493</guid>
      <dc:creator />
      <dc:date>2011-06-16T06:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: Count items with max date</title>
      <link>https://community.qlik.com/t5/QlikView/Count-items-with-max-date/m-p/292301#M108494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Jeroen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using NODISTINCT because in this case the aggregation may return more than one result (higher date) according to the dimensions I'm using. By default, Aggr may return only one value, but in this case I want to get the "max of the max" values in date field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/people/mabaeyens" style="font-size: 12px; outline-style: none; padding-top: 1px; padding-bottom: 1px; padding-left: 17px; color: #007fc0; zoom: 1; background-position: no-repeat no-repeat;"&gt;Miguel Angel Baeyens&lt;/A&gt;&lt;/P&gt;&lt;P&gt;BI Consultant&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://www.grupocomex.com/" style="font-size: 12px; outline-style: none; color: #007fc0;"&gt;Comex Grupo Ibérica&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2011 07:00:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-items-with-max-date/m-p/292301#M108494</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-06-16T07:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: Count items with max date</title>
      <link>https://community.qlik.com/t5/QlikView/Count-items-with-max-date/m-p/292302#M108495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #000000; font-family: arial, sans-serif; font-size: 12.8px;"&gt;&lt;SPAN style="font-size: 11pt; font-family: Calibri, sans-serif;"&gt;Hello Miguel Angel,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #000000; font-family: arial, sans-serif; font-size: 12.8px;"&gt;&lt;SPAN style="font-size: 11pt; font-family: Calibri, sans-serif;"&gt;I am using the following formula:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #000000; font-family: arial, sans-serif; font-size: 12.8px;"&gt;&lt;SPAN style="font-size: 11pt; font-family: Calibri, sans-serif;"&gt;sum (If (Aggr (NODISTINCT max (Date), Local_Id, SKU) = Date, Value))&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #000000; font-family: arial, sans-serif; font-size: 12.8px;"&gt;&lt;SPAN style="font-size: 11pt; font-family: Calibri, sans-serif;"&gt;Which works perfect for the last date of the model. The problem is that when filtering by any date, the formula does not work in the same way.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #000000; font-family: arial, sans-serif; font-size: 12.8px;"&gt;&lt;SPAN style="font-size: 11pt; font-family: Calibri, sans-serif;"&gt;Is there any way to leave it running in order to use the Date as a dynamic field?&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #000000; font-family: arial, sans-serif; font-size: 12.8px;"&gt;&lt;SPAN style="font-size: 11pt; font-family: Calibri, sans-serif;"&gt;thank you very much&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jan 2018 18:45:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Count-items-with-max-date/m-p/292302#M108495</guid>
      <dc:creator>nerrazuriz</dc:creator>
      <dc:date>2018-01-24T18:45:34Z</dc:date>
    </item>
  </channel>
</rss>

