<?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 Sum(max(YearMonth)) for each year in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sum-max-YearMonth-for-each-year/m-p/1108252#M462709</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a pivot table with an ID, Year, and several metrics.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Year&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Metrics (sPIF)&lt;/P&gt;&lt;P&gt;ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;EM&gt;Values&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need one expression that sums the sPIF (by ID) for each year (2013-2016), by month.&amp;nbsp; If no YearMonth’s are selected, then I need the sPIF sum of each Year’s max(YearMonth).&amp;nbsp; Current Year would be 201608.&amp;nbsp; If a YearMonth is selected, I need the sum of the same YearMonth 2013-2016.&amp;nbsp; All months cannot be summed, just the max YearMonth for each year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Examples:&lt;/P&gt;&lt;UL style="list-style-type: disc;"&gt;&lt;LI&gt;- YearMonth selections = 201606.&amp;nbsp; 201606 sPIF is summed.&amp;nbsp; 201506 is summed.&amp;nbsp; 201406 is summed.&amp;nbsp; 201306 is summed.&lt;/LI&gt;&lt;LI&gt;- YearMonth selections = 201510.&amp;nbsp; 201608 sPIF is summed (201608 is the max(YearMonth) in 2016).&amp;nbsp; 201510 is summed.&amp;nbsp; 201410 is summed.&amp;nbsp; 201310 is summed.&lt;/LI&gt;&lt;LI&gt;- YearMonth selections = Nothing selected.&amp;nbsp; Default view – 201608 sPIF is summed.&amp;nbsp; 201512 is summed, 201412 is summed, 201312 is summed.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are a few expressions that I tried:&lt;/P&gt;&lt;P&gt;If(Left(max(YearMonth),4)&amp;gt;='$(vMaxsYear)' and GetSelectedCount(YearMonth)=0,sum({&amp;lt;YearMonth={"$(=max(YearMonth))"}&amp;gt;}sPIF),sum(sPIF))&lt;BR /&gt; &lt;BR /&gt; If(right(max(YearMonth),2)&amp;gt;='$(vMaxsMonth)',sum({&amp;lt;YearMonth={"$(=max(YearMonth))"}&amp;gt;}sPIF),sum(sPIF))&lt;BR /&gt; &lt;BR /&gt; sum({&amp;lt;sMonth={"$(=max(sMonth))"}&amp;gt;} sPIF)&lt;BR /&gt; &lt;BR /&gt; sum({&amp;lt;YearMonth={"$(=max(YearMonth))"}&amp;gt;} Total &amp;lt;sYear,AgtId&amp;gt; sPIF)&lt;BR /&gt; &lt;BR /&gt; sum({&amp;lt;YearMonth={"$(=max(YearMonth))"}&amp;gt;} sPIF)&lt;BR /&gt; &lt;BR /&gt; Sum({&amp;lt;YearMonth = {'$(vYrMth)'}&amp;gt;} sPIF)&lt;BR /&gt; &lt;STRONG&gt;&lt;BR /&gt; &lt;/STRONG&gt;Sum({$&amp;lt;YearMonth={$(=if(max(YearMonth)=max({1}YearMonth), Date(AddMonths(Now(),-1),'YYYYMM'), max(YearMonth))) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I scoured the forums, but cannot find anything to apply.&amp;nbsp; Any/all help is getting the correct expression will be greatly appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Aug 2016 17:45:53 GMT</pubDate>
    <dc:creator>jcampbell474</dc:creator>
    <dc:date>2016-08-29T17:45:53Z</dc:date>
    <item>
      <title>Sum(max(YearMonth)) for each year</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-max-YearMonth-for-each-year/m-p/1108252#M462709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a pivot table with an ID, Year, and several metrics.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Year&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Metrics (sPIF)&lt;/P&gt;&lt;P&gt;ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;EM&gt;Values&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need one expression that sums the sPIF (by ID) for each year (2013-2016), by month.&amp;nbsp; If no YearMonth’s are selected, then I need the sPIF sum of each Year’s max(YearMonth).&amp;nbsp; Current Year would be 201608.&amp;nbsp; If a YearMonth is selected, I need the sum of the same YearMonth 2013-2016.&amp;nbsp; All months cannot be summed, just the max YearMonth for each year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Examples:&lt;/P&gt;&lt;UL style="list-style-type: disc;"&gt;&lt;LI&gt;- YearMonth selections = 201606.&amp;nbsp; 201606 sPIF is summed.&amp;nbsp; 201506 is summed.&amp;nbsp; 201406 is summed.&amp;nbsp; 201306 is summed.&lt;/LI&gt;&lt;LI&gt;- YearMonth selections = 201510.&amp;nbsp; 201608 sPIF is summed (201608 is the max(YearMonth) in 2016).&amp;nbsp; 201510 is summed.&amp;nbsp; 201410 is summed.&amp;nbsp; 201310 is summed.&lt;/LI&gt;&lt;LI&gt;- YearMonth selections = Nothing selected.&amp;nbsp; Default view – 201608 sPIF is summed.&amp;nbsp; 201512 is summed, 201412 is summed, 201312 is summed.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are a few expressions that I tried:&lt;/P&gt;&lt;P&gt;If(Left(max(YearMonth),4)&amp;gt;='$(vMaxsYear)' and GetSelectedCount(YearMonth)=0,sum({&amp;lt;YearMonth={"$(=max(YearMonth))"}&amp;gt;}sPIF),sum(sPIF))&lt;BR /&gt; &lt;BR /&gt; If(right(max(YearMonth),2)&amp;gt;='$(vMaxsMonth)',sum({&amp;lt;YearMonth={"$(=max(YearMonth))"}&amp;gt;}sPIF),sum(sPIF))&lt;BR /&gt; &lt;BR /&gt; sum({&amp;lt;sMonth={"$(=max(sMonth))"}&amp;gt;} sPIF)&lt;BR /&gt; &lt;BR /&gt; sum({&amp;lt;YearMonth={"$(=max(YearMonth))"}&amp;gt;} Total &amp;lt;sYear,AgtId&amp;gt; sPIF)&lt;BR /&gt; &lt;BR /&gt; sum({&amp;lt;YearMonth={"$(=max(YearMonth))"}&amp;gt;} sPIF)&lt;BR /&gt; &lt;BR /&gt; Sum({&amp;lt;YearMonth = {'$(vYrMth)'}&amp;gt;} sPIF)&lt;BR /&gt; &lt;STRONG&gt;&lt;BR /&gt; &lt;/STRONG&gt;Sum({$&amp;lt;YearMonth={$(=if(max(YearMonth)=max({1}YearMonth), Date(AddMonths(Now(),-1),'YYYYMM'), max(YearMonth))) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I scoured the forums, but cannot find anything to apply.&amp;nbsp; Any/all help is getting the correct expression will be greatly appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Aug 2016 17:45:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-max-YearMonth-for-each-year/m-p/1108252#M462709</guid>
      <dc:creator>jcampbell474</dc:creator>
      <dc:date>2016-08-29T17:45:53Z</dc:date>
    </item>
  </channel>
</rss>

