<?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 Multiple value selection causes incorrect value, for result from set analysis, not sure why, Please advise. in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Multiple-value-selection-causes-incorrect-value-for-result-from/m-p/219361#M72390</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&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;&lt;BR /&gt;when more than one date is selected the value calculated through set analysis is incorrect, but when one value is selected, correct value is calculated&lt;BR /&gt;&lt;BR /&gt;My sample file is attached.&lt;BR /&gt;&lt;BR /&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;&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;&lt;BR /&gt;But I would like to do&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;BR /&gt;&lt;BR /&gt;What am I missing? Please advise.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Apr 2011 02:42:05 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-04-18T02:42:05Z</dc:date>
    <item>
      <title>Multiple value selection causes incorrect value, for result from set analysis, not sure why, Please advise.</title>
      <link>https://community.qlik.com/t5/QlikView/Multiple-value-selection-causes-incorrect-value-for-result-from/m-p/219361#M72390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&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;&lt;BR /&gt;when more than one date is selected the value calculated through set analysis is incorrect, but when one value is selected, correct value is calculated&lt;BR /&gt;&lt;BR /&gt;My sample file is attached.&lt;BR /&gt;&lt;BR /&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;&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;&lt;BR /&gt;But I would like to do&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;BR /&gt;&lt;BR /&gt;What am I missing? Please advise.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Apr 2011 02:42:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Multiple-value-selection-causes-incorrect-value-for-result-from/m-p/219361#M72390</guid>
      <dc:creator />
      <dc:date>2011-04-18T02:42:05Z</dc:date>
    </item>
  </channel>
</rss>

