<?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 Prev Quarter Sales Calculation in Grid table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Prev-Quarter-Sales-Calculation-in-Grid-table/m-p/1397645#M424090</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;We are developing a grid table where we need to create two measures&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;1) Current Quarter Sales &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;2) Previous Quarter Sales&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;and the grid table will contain following columns&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Sales.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/185105_Sales.png" style="height: 164px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;We are facing issues in calculating the Prev Quarter Sales measure&lt;/P&gt;&lt;P&gt;we have used below formulas to calculate the measure&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;sum({&amp;lt;QuarterID={"=$((QuarterID)-1)"}&amp;gt;}Sales)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;We have also tried using variable approach&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 13.3333px;"&gt;sum({&amp;lt;QuarterID={$(=$(vPQuarterID))}&amp;gt;}Sales)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;but we are getting zero or null values&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Needed some guidance on it&lt;/P&gt;&lt;P&gt;I have attached sample data file&amp;nbsp; which contains sales at day level&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bhargav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 29 Nov 2017 14:57:07 GMT</pubDate>
    <dc:creator>bhargav_bhat</dc:creator>
    <dc:date>2017-11-29T14:57:07Z</dc:date>
    <item>
      <title>Prev Quarter Sales Calculation in Grid table</title>
      <link>https://community.qlik.com/t5/QlikView/Prev-Quarter-Sales-Calculation-in-Grid-table/m-p/1397645#M424090</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;We are developing a grid table where we need to create two measures&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;1) Current Quarter Sales &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;2) Previous Quarter Sales&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;and the grid table will contain following columns&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Sales.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/185105_Sales.png" style="height: 164px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;We are facing issues in calculating the Prev Quarter Sales measure&lt;/P&gt;&lt;P&gt;we have used below formulas to calculate the measure&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;sum({&amp;lt;QuarterID={"=$((QuarterID)-1)"}&amp;gt;}Sales)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;We have also tried using variable approach&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 13.3333px;"&gt;sum({&amp;lt;QuarterID={$(=$(vPQuarterID))}&amp;gt;}Sales)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;but we are getting zero or null values&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Needed some guidance on it&lt;/P&gt;&lt;P&gt;I have attached sample data file&amp;nbsp; which contains sales at day level&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bhargav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2017 14:57:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Prev-Quarter-Sales-Calculation-in-Grid-table/m-p/1397645#M424090</guid>
      <dc:creator>bhargav_bhat</dc:creator>
      <dc:date>2017-11-29T14:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: Prev Quarter Sales Calculation in Grid table</title>
      <link>https://community.qlik.com/t5/QlikView/Prev-Quarter-Sales-Calculation-in-Grid-table/m-p/1397646#M424091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you define your variable in your second statement?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2017 15:57:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Prev-Quarter-Sales-Calculation-in-Grid-table/m-p/1397646#M424091</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2017-11-29T15:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: Prev Quarter Sales Calculation in Grid table</title>
      <link>https://community.qlik.com/t5/QlikView/Prev-Quarter-Sales-Calculation-in-Grid-table/m-p/1397647#M424092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be you need this&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Above(Sum(Sales))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2017 16:07:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Prev-Quarter-Sales-Calculation-in-Grid-table/m-p/1397647#M424092</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-11-29T16:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: Prev Quarter Sales Calculation in Grid table</title>
      <link>https://community.qlik.com/t5/QlikView/Prev-Quarter-Sales-Calculation-in-Grid-table/m-p/1397648#M424093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for replying&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We tried using this function but we get null values for rows having previous row as different product sub type&lt;/P&gt;&lt;P&gt;Also the data will be sorted by total sales so the previous row might contain a different quarter&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bhargav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2017 16:13:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Prev-Quarter-Sales-Calculation-in-Grid-table/m-p/1397648#M424093</guid>
      <dc:creator>bhargav_bhat</dc:creator>
      <dc:date>2017-11-29T16:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: Prev Quarter Sales Calculation in Grid table</title>
      <link>https://community.qlik.com/t5/QlikView/Prev-Quarter-Sales-Calculation-in-Grid-table/m-p/1397649#M424094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;QuarterID -1 is the expression in the variable&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2017 16:15:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Prev-Quarter-Sales-Calculation-in-Grid-table/m-p/1397649#M424094</guid>
      <dc:creator>bhargav_bhat</dc:creator>
      <dc:date>2017-11-29T16:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: Prev Quarter Sales Calculation in Grid table</title>
      <link>https://community.qlik.com/t5/QlikView/Prev-Quarter-Sales-Calculation-in-Grid-table/m-p/1397650#M424095</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Above(&lt;SPAN style="color: #ff0000;"&gt;TOTAL&lt;/SPAN&gt; Sum(Sales))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2017 16:15:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Prev-Quarter-Sales-Calculation-in-Grid-table/m-p/1397650#M424095</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-11-29T16:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Prev Quarter Sales Calculation in Grid table</title>
      <link>https://community.qlik.com/t5/QlikView/Prev-Quarter-Sales-Calculation-in-Grid-table/m-p/1397651#M424096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried using&amp;nbsp; Above(Total sum(sales)) but there two issues &lt;/P&gt;&lt;OL&gt;&lt;LI&gt; All the dimensions needs to be sorted properly as above function takes previous row value&lt;/LI&gt;&lt;LI&gt;It takes wrong value from for rows where the previous product type or sub type is different&amp;nbsp; as shown below&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;IMG alt="above Sales.png" class="jive-image image-1" src="/legacyfs/online/185141_above Sales.png" style="height: 138px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2017 17:18:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Prev-Quarter-Sales-Calculation-in-Grid-table/m-p/1397651#M424096</guid>
      <dc:creator>bhargav_bhat</dc:creator>
      <dc:date>2017-11-29T17:18:57Z</dc:date>
    </item>
    <item>
      <title>Re: Prev Quarter Sales Calculation in Grid table</title>
      <link>https://community.qlik.com/t5/QlikView/Prev-Quarter-Sales-Calculation-in-Grid-table/m-p/1397652#M424097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here are my questions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) How many dimensions do you have in your chart? 2 or 3?&lt;/P&gt;&lt;P&gt;2) You don't want Product Type to cross over, right? Then you def. don't need TOTAL here... my first response stay... but I guess is that sorting can be off based on what you mentioned... in that case, you can give this a shot&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Aggr(Above(Sum(Sales)), ProductType, YearQuarter)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Aggr function will sort first by ProductType and then by YearQuarter, no matter how the table is sorted. But the only issue that might come up is that if the sorting of YearQuarter field in the script is not done correctly, then you might see issues. These issues can be addressed if you are using QV12 or above or using Qlik Sense using &lt;A href="https://community.qlik.com/qlik-blogpost/4673"&gt;The sortable Aggr function is finally here!&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;Aggr(Above(Sum(Sales)), ProductType, (YearQuarter, (TEXT)))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2017 17:23:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Prev-Quarter-Sales-Calculation-in-Grid-table/m-p/1397652#M424097</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-11-29T17:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: Prev Quarter Sales Calculation in Grid table</title>
      <link>https://community.qlik.com/t5/QlikView/Prev-Quarter-Sales-Calculation-in-Grid-table/m-p/1397653#M424098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot !!!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used the following function for getting the Previous Quarter Sales&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Aggr(Above(Sum([Total sales])),[Product Type],[Product Sub Type],(QuarterID,(NUMERIC, ASCENDING)))&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;Was not aware about the hidden features of&amp;nbsp;&amp;nbsp; AGGR function.It made the calculations a lot easier&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;Bhargav&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2017 18:13:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Prev-Quarter-Sales-Calculation-in-Grid-table/m-p/1397653#M424098</guid>
      <dc:creator>bhargav_bhat</dc:creator>
      <dc:date>2017-11-29T18:13:16Z</dc:date>
    </item>
  </channel>
</rss>

