<?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 with sum (firstsortedvalue) in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Problem-with-sum-firstsortedvalue/m-p/476127#M177804</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Both sum and firstsortedvalue are aggregation functions. That means you need the aggr function in between. Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(aggr( if(....etc ) , MyDim1, MyDim2,... etc) )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Replace MyDim1, MyDim2,....etc with the dimensions over which you want to aggregate the results of the firstsortedvalue expression. Usually those are the same as your chart dimensions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Jul 2013 16:56:32 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2013-07-12T16:56:32Z</dc:date>
    <item>
      <title>Problem with sum (firstsortedvalue)</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-sum-firstsortedvalue/m-p/476126#M177803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm having problems with the following expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I use like this, it works perfectly:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(((DIM_A=23110 and FirstSortedValue(DIM_B, -DIM_C)&amp;lt;=5000000) or (DIM_A&amp;lt;&amp;gt;23110 and FirstSortedValue(DIM_B, -DIM_C)&amp;lt;=5000000))&lt;/P&gt;&lt;P&gt;,FirstSortedValue(DIM_B, -DIM_C))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I try to sum the results, it does not work (Error in expression):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum( &lt;/P&gt;&lt;P&gt;if(((DIM_A=23110 and FirstSortedValue(DIM_B, -DIM_C)&amp;lt;=5000000) or (DIM_A&amp;lt;&amp;gt;23110 and FirstSortedValue(DIM_B, -DIM_C)&amp;lt;=5000000))&lt;/P&gt;&lt;P&gt;,FirstSortedValue(DIM_B, -DIM_C))&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've also tried to insert the sum inside if statement, but nothing changes....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(((DIM_A=23110 and FirstSortedValue(DIM_B, -DIM_C)&amp;lt;=5000000) or (DIM_A&amp;lt;&amp;gt;23110 and FirstSortedValue(DIM_B, -DIM_C)&amp;lt;=5000000))&lt;/P&gt;&lt;P&gt;,Sum(FirstSortedValue(DIM_B, -DIM_C)))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Gabriele&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jul 2013 16:51:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-sum-firstsortedvalue/m-p/476126#M177803</guid>
      <dc:creator />
      <dc:date>2013-07-12T16:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with sum (firstsortedvalue)</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-sum-firstsortedvalue/m-p/476127#M177804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Both sum and firstsortedvalue are aggregation functions. That means you need the aggr function in between. Something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(aggr( if(....etc ) , MyDim1, MyDim2,... etc) )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Replace MyDim1, MyDim2,....etc with the dimensions over which you want to aggregate the results of the firstsortedvalue expression. Usually those are the same as your chart dimensions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jul 2013 16:56:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-sum-firstsortedvalue/m-p/476127#M177804</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-07-12T16:56:32Z</dc:date>
    </item>
  </channel>
</rss>

