<?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: Sum(amount) based on max(value) in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sum-amount-based-on-max-value/m-p/1273852#M856426</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also try this&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=FirstSortedValue(Aggr(sum([Amount CY]),BookId,bookversid) ,-&amp;nbsp; Aggr(max(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Bookdate&lt;/SPAN&gt;),BookId,bookversid))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Feb 2017 11:56:30 GMT</pubDate>
    <dc:creator>sasikanth</dc:creator>
    <dc:date>2017-02-15T11:56:30Z</dc:date>
    <item>
      <title>Sum(amount) based on max(value)</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-amount-based-on-max-value/m-p/1273850#M856424</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;&lt;/P&gt;&lt;P&gt;I'm having trouble figuring the following out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following situation. Imagine a travel agency with bookings (bookid), different versions per bookid (bookversid), different bookdates per version (bookdate) and different amount per version, amountCY. See table below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE bgcolor="#ffffff" border="1" cellpadding="2" cellspacing="0" style="font-size: 9pt;"&gt;&lt;TBODY&gt;&lt;TR bgcolor="#f5f5f5"&gt;&lt;TH nowrap="nowrap"&gt;&lt;SPAN style="color: #363636;"&gt;&lt;STRONG&gt;BookId&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/TH&gt;&lt;TH nowrap="nowrap"&gt;&lt;SPAN style="color: #363636;"&gt;&lt;STRONG&gt;bookversid&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/TH&gt;&lt;TH nowrap="nowrap"&gt;&lt;SPAN style="color: #363636;"&gt;&lt;STRONG&gt;Bookdate&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/TH&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;Amount CY&lt;/SPAN&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR bgcolor="#ffffff"&gt;&lt;TD bgcolor="#ffffff" rowspan="3"&gt;&lt;SPAN style="color: #363636;"&gt;105895&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;1058952&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;17-12-2013&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;2660,52&lt;/SPAN&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR bgcolor="#ffffff"&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;1058953&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;16-1-2014&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;4152,5&lt;/SPAN&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR bgcolor="#ffffff"&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;1058954&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;21-7-2014&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;2700&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;With no selection on bookdate I want to sum the amountCY of the latest bookdate. In this case 2700,-&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;If my selection on Bookdate is &amp;gt;= 16-1-2014 I want amount CY 2700 as a result.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;With a Bookdate &amp;gt;= 17-12-2013, &amp;lt;= 16-1-2014 I want amount CY 4152,50 as a result.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;The last thing I tried was:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Max(aggr(Sum(AmountCY),bookversid))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;But that does no give me the result I want. With a Bookdate selection of &amp;gt;1-1-2014 this formula returns two rows, 16-1-2014 and 21-7-2014. But I want only the last row.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;I hope somebody can help me out here.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; Thank you so much in advance!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-amount-based-on-max-value/m-p/1273850#M856424</guid>
      <dc:creator>tcarolus</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Sum(amount) based on max(value)</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-amount-based-on-max-value/m-p/1273851#M856425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try it with: firstsortedvalue([Amount CY], -Bookdate). Also the use of the bookversid might be working in this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Feb 2017 11:02:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-amount-based-on-max-value/m-p/1273851#M856425</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2017-02-15T11:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: Sum(amount) based on max(value)</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-amount-based-on-max-value/m-p/1273852#M856426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also try this&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=FirstSortedValue(Aggr(sum([Amount CY]),BookId,bookversid) ,-&amp;nbsp; Aggr(max(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Bookdate&lt;/SPAN&gt;),BookId,bookversid))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Feb 2017 11:56:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-amount-based-on-max-value/m-p/1273852#M856426</guid>
      <dc:creator>sasikanth</dc:creator>
      <dc:date>2017-02-15T11:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: Sum(amount) based on max(value)</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-amount-based-on-max-value/m-p/1273853#M856427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Marcus and sasi thank u so much for sharing your ideas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I must say my colleague helped me out and he found the solution with the following formula:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum(If(Aggr(NODISTINCT Max(bookversid),BookId)=bookversid,AmountCY))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Feb 2017 23:23:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-amount-based-on-max-value/m-p/1273853#M856427</guid>
      <dc:creator>tcarolus</dc:creator>
      <dc:date>2017-02-15T23:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: Sum(amount) based on max(value)</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-amount-based-on-max-value/m-p/1273854#M856428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tamarah,&lt;/P&gt;&lt;P&gt;Please try this logic.&lt;/P&gt;&lt;P&gt;=Sum( {&amp;lt;Bookdate={'=Bookdate=$(=max(Bookdate))'}&amp;gt;}&amp;nbsp; [Amount CY])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Feb 2017 07:34:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-amount-based-on-max-value/m-p/1273854#M856428</guid>
      <dc:creator>soloeeeoff</dc:creator>
      <dc:date>2017-02-16T07:34:33Z</dc:date>
    </item>
  </channel>
</rss>

