<?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: changing calculation for Partial Sums using SecondaryDimentionality in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/changing-calculation-for-Partial-Sums-using/m-p/1589008#M443407</link>
    <description>&lt;P&gt;Thank you very much Sunny, this works perfectly!&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jun 2019 12:14:54 GMT</pubDate>
    <dc:creator>Emil_bros</dc:creator>
    <dc:date>2019-06-06T12:14:54Z</dc:date>
    <item>
      <title>changing calculation for Partial Sums using SecondaryDimentionality</title>
      <link>https://community.qlik.com/t5/QlikView/changing-calculation-for-Partial-Sums-using/m-p/1588872#M443398</link>
      <description>&lt;P&gt;Hello Colleagues,&lt;/P&gt;&lt;P&gt;I need to change the logic of partial sums calculation in pivot table. For year quartes, instead of sum of 3 month, I need the &lt;STRONG&gt;last month value to be presented as quarter total. &lt;/STRONG&gt;I use &lt;STRONG&gt;SecondaryDimentionality&lt;/STRONG&gt; but it won't work properly'&lt;/P&gt;&lt;P&gt;In given example, instead of 19730 (sum of months) I want to get 6317 (last month val)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture3.PNG" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/13268i366F57CF3F37F9B9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture3.PNG" alt="Capture3.PNG" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;To solve this I use&lt;STRONG&gt; secondary dimentionality&lt;/STRONG&gt; to locate on which level of cumulation given section is.&lt;/P&gt;&lt;P&gt;After that I use &lt;STRONG&gt;Max(Month) &lt;/STRONG&gt;to check if last month of the quarter is properly defined for quarter total column&amp;nbsp; - and it works - for Q1 I get 06-2019, for Q2 I get 09-2019.&lt;/P&gt;&lt;P&gt;then I use Max(Month) in&lt;STRONG&gt; final formula&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;if(&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;SecondaryDimensionality() = 1,&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;sum(Stock),&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;sum( {&amp;lt;Month = {'$(=Max(Month))'}&amp;gt;} Stock)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Sadly the result is &lt;STRONG&gt;correct only for highest quarter&lt;/STRONG&gt; . In example below - correct for Q2 and total overall, incorrect for Q1. It's strange because Max(Month) correctly assigned 06-2019 as last month of Q1.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="apture4.PNG" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/13269i419841F09942A99A/image-size/large?v=v2&amp;amp;px=999" role="button" title="apture4.PNG" alt="apture4.PNG" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Any ideas where I went wrong?&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Emil&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 08:20:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/changing-calculation-for-Partial-Sums-using/m-p/1588872#M443398</guid>
      <dc:creator>Emil_bros</dc:creator>
      <dc:date>2019-06-06T08:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: changing calculation for Partial Sums using SecondaryDimentionality</title>
      <link>https://community.qlik.com/t5/QlikView/changing-calculation-for-Partial-Sums-using/m-p/1588994#M443404</link>
      <description>&lt;P&gt;Try doing this using Aggr() function...&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;If(
SecondaryDimensionality() = 1,
Sum(Stock),
Sum(Aggr(If(GPSI_Month = Max(TOTAL &amp;lt;GPSI_QUARTER&amp;gt; GPSI_Month), Sum(Stock)), GPSI_QUARTER, GPSI_Month))
)&lt;/LI-CODE&gt;&lt;P&gt;You might be able to use FirstSortedValue() function, but I would need a sample to test it out.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 11:46:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/changing-calculation-for-Partial-Sums-using/m-p/1588994#M443404</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-06-06T11:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: changing calculation for Partial Sums using SecondaryDimentionality</title>
      <link>https://community.qlik.com/t5/QlikView/changing-calculation-for-Partial-Sums-using/m-p/1589008#M443407</link>
      <description>&lt;P&gt;Thank you very much Sunny, this works perfectly!&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 12:14:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/changing-calculation-for-Partial-Sums-using/m-p/1589008#M443407</guid>
      <dc:creator>Emil_bros</dc:creator>
      <dc:date>2019-06-06T12:14:54Z</dc:date>
    </item>
  </channel>
</rss>

