<?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: Sort by latest date and summarize in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sort-by-latest-date-and-summarize/m-p/896059#M311854</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ohh my bad, thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;however I still keep getting '-' not any value, any idea on this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 Jun 2015 14:51:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-06-02T14:51:24Z</dc:date>
    <item>
      <title>Sort by latest date and summarize</title>
      <link>https://community.qlik.com/t5/QlikView/Sort-by-latest-date-and-summarize/m-p/896055#M311850</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;I need to sort the invoice numbers by the latest date and summarize it based on the invoice amount, I basically need to check if the total of PO amount is less than total of invoice amount, the problem I am having is that 1 PO has many invoices. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All I need is the latest invoice with sum of all invoices to tie out with the PO number. Ideal Output is attached in the file. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's really annoying how simple things like summarizing and removing duplicates is a challenge in QV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please advise&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Sunny &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jun 2015 12:27:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sort-by-latest-date-and-summarize/m-p/896055#M311850</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-02T12:27:14Z</dc:date>
    </item>
    <item>
      <title>Re: Sort by latest date and summarize</title>
      <link>https://community.qlik.com/t5/QlikView/Sort-by-latest-date-and-summarize/m-p/896056#M311851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use FirstSortedValue().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dimension:&lt;/P&gt;&lt;P&gt;PO_NO&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expressions:&lt;/P&gt;&lt;P&gt;=FirstSortedValue(INVOICE_NO, - INVOICE_CREATION_DT)&lt;/P&gt;&lt;P&gt;=Date(max(INVOICE_CREATION_DT))&lt;/P&gt;&lt;P&gt;=FirstSortedValue(ORG_ID,-INVOICE_CREATION_DT)&lt;/P&gt;&lt;P&gt;=FirstSortedValue(LE_CD,-INVOICE_CREATION_DT)&lt;/P&gt;&lt;P&gt;=FirstSortedValue([sum(PO_OPENING_BAL_USD)] ,-INVOICE_CREATION_DT)&lt;/P&gt;&lt;P&gt;=sum([sum(LINE_INVOICE_AMOUNT)])&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jun 2015 13:57:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sort-by-latest-date-and-summarize/m-p/896056#M311851</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2015-06-02T13:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: Sort by latest date and summarize</title>
      <link>https://community.qlik.com/t5/QlikView/Sort-by-latest-date-and-summarize/m-p/896057#M311852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the response, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However I am getting - in place of any values now. Please advise&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also these expressions are wrong, why do u have 2 sums for line invoice amount&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; background-color: #f2f2f2;"&gt;=FirstSortedValue([sum(PO_OPENING_BAL_USD)] ,-INVOICE_CREATION_DT)&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; background-color: #f2f2f2;"&gt;=sum([sum(LINE_INVOICE_AMOUNT)])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jun 2015 14:33:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sort-by-latest-date-and-summarize/m-p/896057#M311852</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-02T14:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: Sort by latest date and summarize</title>
      <link>https://community.qlik.com/t5/QlikView/Sort-by-latest-date-and-summarize/m-p/896058#M311853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I used the excel file you've provided. The field name is [sum(LINE_INVOICE_AMOUNT)]. It's a field name and not a sum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Replace with your field names.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jun 2015 14:46:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sort-by-latest-date-and-summarize/m-p/896058#M311853</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2015-06-02T14:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: Sort by latest date and summarize</title>
      <link>https://community.qlik.com/t5/QlikView/Sort-by-latest-date-and-summarize/m-p/896059#M311854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ohh my bad, thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;however I still keep getting '-' not any value, any idea on this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jun 2015 14:51:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sort-by-latest-date-and-summarize/m-p/896059#M311854</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-02T14:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: Sort by latest date and summarize</title>
      <link>https://community.qlik.com/t5/QlikView/Sort-by-latest-date-and-summarize/m-p/896060#M311855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hey I got it, I had to change the date format in the script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One more doubt, what if I had to take the oldest date, i mean in descending order, which function will work then??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jun 2015 14:59:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sort-by-latest-date-and-summarize/m-p/896060#M311855</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-02T14:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: Sort by latest date and summarize</title>
      <link>https://community.qlik.com/t5/QlikView/Sort-by-latest-date-and-summarize/m-p/896061#M311856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you post a more detailed view of your data?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have multiple records per INVOICE_CREATION_DT, FirstSortedValue will return NULL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But you can aggregate like&lt;/P&gt;&lt;P&gt;=FirstSortedValue( aggr(sum(PO_OPENING_BAL_USD), INVOICE_CREATION_DT), aggr( -INVOICE_CREATION_DT, INVOICE_CREATION_DT) )&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jun 2015 15:00:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sort-by-latest-date-and-summarize/m-p/896061#M311856</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2015-06-02T15:00:29Z</dc:date>
    </item>
  </channel>
</rss>

