<?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: Problem Max Function on Set Analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Problem-Max-Function-on-Set-Analysis/m-p/865010#M302640</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the example you have given the max date for apples is 12-31-2014 and on that date quantity is 4 so count is equaling 0. If I change your data a little bit, then this should give you the correct result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SET DateFormat='MM-DD-YYYY';&lt;/STRONG&gt;&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 * INLINE [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Product, Quantity, Date, ID&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Apple, 9, 08-01-2014, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Apple, 4, 03-01-2014, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Orange, 44, 04-01-2014, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Orange, 44, 11-01-2014, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Orange, 44, 08-30-2014, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Orange, 44, 11-01-2014, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Apple, 4, 12-31-2014, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Orange, 44, 01-01-2013, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &lt;SPAN style="color: #ff0000;"&gt;&amp;nbsp; Apple, 7, 05-01-2015, 1&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #ff0000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Apple, 7, 05-01-2015, 5&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and using this expression:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=Count({&amp;lt;Product={'Apple'}, Quantity={"&amp;gt;=5"}, Date={"$(=Date(Max({&amp;lt;Product = {'Apple'}&amp;gt;}Date), 'MM-DD-YYYY'))"}&amp;gt;} Distinct ID)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get output 2 in a text box object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find attached the qvw for reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&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>Fri, 15 May 2015 12:47:50 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2015-05-15T12:47:50Z</dc:date>
    <item>
      <title>Problem Max Function on Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-Max-Function-on-Set-Analysis/m-p/865005#M302635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Community, I'm having a problem that I hope you can help me with:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following situation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to count every ID when the product is Apple, the quantity is higher or iqual than 5 and the highest of the Dates that remains of the previous restrictions.&lt;/P&gt;&lt;P&gt;The table would be like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Max.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/86632_Max.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So far, I've tried the following sentence:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;count({&amp;lt;Product={'Apple'}, quantity={"&amp;gt;=5"}, Date=Max(Date)&amp;gt;} Distinct ID)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expression should give as a result 2 ID's.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which is the correct syntax for the Max Function? so far every other sentence works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 21:11:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-Max-Function-on-Set-Analysis/m-p/865005#M302635</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-14T21:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Max Function on Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-Max-Function-on-Set-Analysis/m-p/865006#M302636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is it currently returning?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 21:56:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-Max-Function-on-Set-Analysis/m-p/865006#M302636</guid>
      <dc:creator>dgreenberg</dc:creator>
      <dc:date>2015-05-14T21:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Max Function on Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-Max-Function-on-Set-Analysis/m-p/865007#M302637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The correct syntax for the max date will be&lt;BR /&gt;Date={"$(=date(max(Date)))"}&lt;/P&gt;&lt;P&gt;(Given the sample of the data, I don't see that the date condition is needed though)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit: After looking more at this, I think that the date condition will be harmful.&amp;nbsp; You'll be better of without it.&amp;nbsp; Or, I didn't understand the requirements right (?)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 22:02:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-Max-Function-on-Set-Analysis/m-p/865007#M302637</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-14T22:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Max Function on Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-Max-Function-on-Set-Analysis/m-p/865008#M302638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an example of the syntax in &lt;A href="https://community.qlik.com/docs/DOC-8490"&gt;Set expression and dollar expansion&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This example also show that the Max() aggregation is not evaluated on each row, which is important to keep in mind.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 22:58:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-Max-Function-on-Set-Analysis/m-p/865008#M302638</guid>
      <dc:creator>ToniKautto</dc:creator>
      <dc:date>2015-05-14T22:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Max Function on Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-Max-Function-on-Set-Analysis/m-p/865009#M302639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Still not working, the expression is not returning any value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there another way to do what I need to do without the max function?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 May 2015 12:26:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-Max-Function-on-Set-Analysis/m-p/865009#M302639</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-15T12:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Max Function on Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-Max-Function-on-Set-Analysis/m-p/865010#M302640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the example you have given the max date for apples is 12-31-2014 and on that date quantity is 4 so count is equaling 0. If I change your data a little bit, then this should give you the correct result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SET DateFormat='MM-DD-YYYY';&lt;/STRONG&gt;&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 * INLINE [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Product, Quantity, Date, ID&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Apple, 9, 08-01-2014, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Apple, 4, 03-01-2014, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Orange, 44, 04-01-2014, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Orange, 44, 11-01-2014, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Orange, 44, 08-30-2014, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Orange, 44, 11-01-2014, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Apple, 4, 12-31-2014, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Orange, 44, 01-01-2013, 1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &lt;SPAN style="color: #ff0000;"&gt;&amp;nbsp; Apple, 7, 05-01-2015, 1&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #ff0000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Apple, 7, 05-01-2015, 5&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and using this expression:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=Count({&amp;lt;Product={'Apple'}, Quantity={"&amp;gt;=5"}, Date={"$(=Date(Max({&amp;lt;Product = {'Apple'}&amp;gt;}Date), 'MM-DD-YYYY'))"}&amp;gt;} Distinct ID)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get output 2 in a text box object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find attached the qvw for reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&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>Fri, 15 May 2015 12:47:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-Max-Function-on-Set-Analysis/m-p/865010#M302640</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-05-15T12:47:50Z</dc:date>
    </item>
  </channel>
</rss>

