<?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 Finding the diff of a column between current week and previous week in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Finding-the-diff-of-a-column-between-current-week-and-previous/m-p/219138#M72184</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, Thank you for the reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I sum up in the load script then when the diff for each individual at the pivot table is not correct.&lt;/P&gt;&lt;P&gt;So I modified the tables and added a table that would have previous date for each load date, and then used set analysis to calculate the diff.&lt;/P&gt;&lt;P&gt;However when more than one date is selected the value I get is incorrect. Please help.&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;My sample file is attached.&lt;/P&gt;&lt;P&gt;Date selected - calculated diff&lt;BR /&gt;&lt;BR /&gt;1/1/2011 - 0&lt;BR /&gt;1/7/2011 - 52&lt;BR /&gt;1/14/2011 - (-10)&lt;BR /&gt;&lt;BR /&gt;But when all the three dates are selected, the diff should be 42 instead it shows as 148&lt;BR /&gt;&lt;BR /&gt;This is because,&lt;BR /&gt;sum(106+158+148) - sum(106+158)&lt;BR /&gt;which is what my formula is.&lt;BR /&gt;&lt;BR /&gt;But I would like to do&lt;BR /&gt;&lt;BR /&gt;formula used : sum({$&amp;lt;Date=P(Date)&amp;gt;} Time)-sum({$&amp;lt;Date=P(PrevDate)&amp;gt;} Time)&lt;BR /&gt;&lt;BR /&gt;sum(Time) - sum(prevTime) using set analysis for each selected date,&lt;BR /&gt;However date is not a dimension in the pivot table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 17 Apr 2011 14:49:29 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-04-17T14:49:29Z</dc:date>
    <item>
      <title>Finding the diff of a column between current week and previous week</title>
      <link>https://community.qlik.com/t5/QlikView/Finding-the-diff-of-a-column-between-current-week-and-previous/m-p/219136#M72182</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;Need some help in calculating the diff of a column between current week and previous week&lt;BR /&gt;&lt;BR /&gt;Project, Version, Date, Person, Time&lt;BR /&gt;Sales, 1.1, 1/1/2011, John, 5&lt;BR /&gt;Sales, 1.1, 1/1/2011, Jim, 6&lt;BR /&gt;Sales, 1.1, 1/7/2011, Jim, 8&lt;BR /&gt;Sales, 1.2, 1/7/2011, John, 10&lt;BR /&gt;Sales, 1.2, 1/14/2011, James, 12&lt;BR /&gt;Sales, 1.2, 1/14/2011, Jim, 8&lt;BR /&gt;&lt;BR /&gt;How can I calculate the difference in time between the selected date and the date before that?&lt;BR /&gt;for instance if 1/7/2011 is selected, then the time should be sum of all time with date 1/7/2011 - sum of all time with date prior to that, if there is no prior date then the same date should be treated as prior date, for instance 1/1/2011 with have the previous date as 1/1/2011.&lt;BR /&gt;&lt;BR /&gt;when 1/1/2011 is selected diff should be 0&lt;BR /&gt;when 1/7/2011 is selected diff should be 7 (18-11)&lt;BR /&gt;when 1/14/2011 is selectd diff should be 2 (20-18)&lt;BR /&gt;&lt;BR /&gt;when 1/14/2011 and 1/7/2011 is selected diff should be 7+2=9&lt;BR /&gt;when all the three dates are selected the diff should be 0+7+2 = 9&lt;BR /&gt;when 1/1/2011 and 1/14/2011 is selected the diff should be 0+2=2&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Apr 2011 02:46:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Finding-the-diff-of-a-column-between-current-week-and-previous/m-p/219136#M72182</guid>
      <dc:creator />
      <dc:date>2011-04-17T02:46:10Z</dc:date>
    </item>
    <item>
      <title>Finding the diff of a column between current week and previous week</title>
      <link>https://community.qlik.com/t5/QlikView/Finding-the-diff-of-a-column-between-current-week-and-previous/m-p/219137#M72183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could assign the previous weeks sum to each group row in the script and then use a chart expression like:&lt;/P&gt;&lt;P&gt;=sum(SumTime - PreviousSumTime)&lt;/P&gt;&lt;P&gt;Your example above shows grouping only by date. Your attached qvw seems to indicate you want to group ny Project and Version. Not sure which you are after, but here's a script example by Date only. You can extend it if you need a finer grouping.&lt;/P&gt;&lt;P&gt;ByDate:&lt;BR /&gt;LOAD&lt;BR /&gt; Date,&lt;BR /&gt; sum(Time) as SumTime&lt;BR /&gt;RESIDENT data&lt;BR /&gt;GROUP BY Date&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;ByDate2:&lt;BR /&gt;LOAD&lt;BR /&gt; *,&lt;BR /&gt; Previous(SumTime) as PreviousSumTime&lt;BR /&gt;RESIDENT ByDate&lt;BR /&gt;ORDER by Date&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;DROP TABLE ByDate;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Apr 2011 05:18:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Finding-the-diff-of-a-column-between-current-week-and-previous/m-p/219137#M72183</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2011-04-17T05:18:16Z</dc:date>
    </item>
    <item>
      <title>Finding the diff of a column between current week and previous week</title>
      <link>https://community.qlik.com/t5/QlikView/Finding-the-diff-of-a-column-between-current-week-and-previous/m-p/219138#M72184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, Thank you for the reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I sum up in the load script then when the diff for each individual at the pivot table is not correct.&lt;/P&gt;&lt;P&gt;So I modified the tables and added a table that would have previous date for each load date, and then used set analysis to calculate the diff.&lt;/P&gt;&lt;P&gt;However when more than one date is selected the value I get is incorrect. Please help.&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;My sample file is attached.&lt;/P&gt;&lt;P&gt;Date selected - calculated diff&lt;BR /&gt;&lt;BR /&gt;1/1/2011 - 0&lt;BR /&gt;1/7/2011 - 52&lt;BR /&gt;1/14/2011 - (-10)&lt;BR /&gt;&lt;BR /&gt;But when all the three dates are selected, the diff should be 42 instead it shows as 148&lt;BR /&gt;&lt;BR /&gt;This is because,&lt;BR /&gt;sum(106+158+148) - sum(106+158)&lt;BR /&gt;which is what my formula is.&lt;BR /&gt;&lt;BR /&gt;But I would like to do&lt;BR /&gt;&lt;BR /&gt;formula used : sum({$&amp;lt;Date=P(Date)&amp;gt;} Time)-sum({$&amp;lt;Date=P(PrevDate)&amp;gt;} Time)&lt;BR /&gt;&lt;BR /&gt;sum(Time) - sum(prevTime) using set analysis for each selected date,&lt;BR /&gt;However date is not a dimension in the pivot table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Apr 2011 14:49:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Finding-the-diff-of-a-column-between-current-week-and-previous/m-p/219138#M72184</guid>
      <dc:creator />
      <dc:date>2011-04-17T14:49:29Z</dc:date>
    </item>
  </channel>
</rss>

