<?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 Is there a way to do period over period calculations without pre-computing the data? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-do-period-over-period-calculations-without-pre/m-p/155452#M31708</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Set analysis on its own only works when you've selected a single week to compare to because the set is built once for the entire chart, not once per row (per week). But if that's all you need, and let's say your week is the Monday date in MM/DD/YY format:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;dimension = Week&lt;BR /&gt;sales this week = sum(Sales)&lt;BR /&gt;sales last week = sum({&amp;lt;Week={'$(=date(Week-7,'MM/DD/YY'))'}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;The actual code will depend on how you define your weeks, though. And like I said, it only works when you've selected one specific week. Otherwise, Week has multiple values, which evaluates to null, which won't match any weeks, so your sum will be 0 or null, I forget which. So I normally suggest an As Of table:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;As of Week, Week Type, Week&lt;BR /&gt;08/09/10, This Week, 08/09/10&lt;BR /&gt;08/09/10, Last Week, 08/02/10&lt;BR /&gt;08/02/10, This Week, 08/02/10&lt;BR /&gt;08/02/10, Last Week, 07/26/10&lt;BR /&gt;...&lt;/P&gt;&lt;P&gt;You'd load that from your actual data, not inline like this, and you'd define your weeks however you want. Then the simplest way to display the results is with a 2D pivot table:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;dimension 1 = As of Week&lt;BR /&gt;dimension 2 = Week Type&lt;BR /&gt;expression = sum(Sales)&lt;/P&gt;&lt;P&gt;But if you wanted a straight table instead, you could do this:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;dimension = As Of Week&lt;BR /&gt;sales this week = sum({&amp;lt;"Week Type"={'This Week'}&amp;gt;} Sales)&lt;BR /&gt;sales last week = sum({&amp;lt;"Week Type"={'Last Week'}&amp;gt;} Sales)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Aug 2010 20:54:26 GMT</pubDate>
    <dc:creator>johnw</dc:creator>
    <dc:date>2010-08-10T20:54:26Z</dc:date>
    <item>
      <title>Is there a way to do period over period calculations without pre-computing the data?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-do-period-over-period-calculations-without-pre/m-p/155451#M31707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've seen a few posts on here that are similar but essentially we are trying to create period over period charts (i.e. sales this week versus last week) and I'm not having much luck. We would rather not pre-compute this in the load scripts but instead create a calculation using set analysis. I would assume there is some sort of default function to leverage but I haven't figured it out if there is.&lt;/P&gt;&lt;P&gt;Can anyone provide the syntax for calculating period over period calculations?&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Aug 2010 18:30:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-do-period-over-period-calculations-without-pre/m-p/155451#M31707</guid>
      <dc:creator />
      <dc:date>2010-08-10T18:30:00Z</dc:date>
    </item>
    <item>
      <title>Is there a way to do period over period calculations without pre-computing the data?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-do-period-over-period-calculations-without-pre/m-p/155452#M31708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Set analysis on its own only works when you've selected a single week to compare to because the set is built once for the entire chart, not once per row (per week). But if that's all you need, and let's say your week is the Monday date in MM/DD/YY format:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;dimension = Week&lt;BR /&gt;sales this week = sum(Sales)&lt;BR /&gt;sales last week = sum({&amp;lt;Week={'$(=date(Week-7,'MM/DD/YY'))'}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;The actual code will depend on how you define your weeks, though. And like I said, it only works when you've selected one specific week. Otherwise, Week has multiple values, which evaluates to null, which won't match any weeks, so your sum will be 0 or null, I forget which. So I normally suggest an As Of table:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;As of Week, Week Type, Week&lt;BR /&gt;08/09/10, This Week, 08/09/10&lt;BR /&gt;08/09/10, Last Week, 08/02/10&lt;BR /&gt;08/02/10, This Week, 08/02/10&lt;BR /&gt;08/02/10, Last Week, 07/26/10&lt;BR /&gt;...&lt;/P&gt;&lt;P&gt;You'd load that from your actual data, not inline like this, and you'd define your weeks however you want. Then the simplest way to display the results is with a 2D pivot table:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;dimension 1 = As of Week&lt;BR /&gt;dimension 2 = Week Type&lt;BR /&gt;expression = sum(Sales)&lt;/P&gt;&lt;P&gt;But if you wanted a straight table instead, you could do this:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;dimension = As Of Week&lt;BR /&gt;sales this week = sum({&amp;lt;"Week Type"={'This Week'}&amp;gt;} Sales)&lt;BR /&gt;sales last week = sum({&amp;lt;"Week Type"={'Last Week'}&amp;gt;} Sales)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Aug 2010 20:54:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-do-period-over-period-calculations-without-pre/m-p/155452#M31708</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-08-10T20:54:26Z</dc:date>
    </item>
    <item>
      <title>Is there a way to do period over period calculations without pre-computing the data?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-do-period-over-period-calculations-without-pre/m-p/155453#M31709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it possible to do this without changing the load scripts or the time dimension?&lt;/P&gt;&lt;P&gt;--Dan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Aug 2010 21:13:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-do-period-over-period-calculations-without-pre/m-p/155453#M31709</guid>
      <dc:creator />
      <dc:date>2010-08-10T21:13:35Z</dc:date>
    </item>
    <item>
      <title>Is there a way to do period over period calculations without pre-computing the data?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-do-period-over-period-calculations-without-pre/m-p/155454#M31710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, if you can suffer with the limitations that the first selected week won't have a previous week value calculated, and that your chart must always be sorted by week (disallow interactive sort), you should be able to use above() to get what you want. I believe it would look like this:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;dimension = Week&lt;BR /&gt;Sales This Week = sum(Sales)&lt;BR /&gt;Sales Last Week = above("Sales This Week")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Aug 2010 21:49:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-do-period-over-period-calculations-without-pre/m-p/155454#M31710</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-08-10T21:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to do period over period calculations without pre-computing the data?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-do-period-over-period-calculations-without-pre/m-p/155455#M31711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John,&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; When you say sales last week = above("sales this week"). Do you mean above(sum(sales))?&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 19:45:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-do-period-over-period-calculations-without-pre/m-p/155455#M31711</guid>
      <dc:creator />
      <dc:date>2016-01-20T19:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to do period over period calculations without pre-computing the data?</title>
      <link>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-do-period-over-period-calculations-without-pre/m-p/155456#M31712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #212121; font-size: 10pt; font-family: arial, sans-serif;"&gt;Attach your example QVW.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 19:54:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Is-there-a-way-to-do-period-over-period-calculations-without-pre/m-p/155456#M31712</guid>
      <dc:creator>israelcsouza</dc:creator>
      <dc:date>2016-01-20T19:54:29Z</dc:date>
    </item>
  </channel>
</rss>

