<?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: Difference by Date and Product in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Difference-by-Date-and-Product/m-p/1368391#M832724</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need this in the script or on the front end of the application?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Jun 2017 11:21:33 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2017-06-14T11:21:33Z</dc:date>
    <item>
      <title>Difference by Date and Product</title>
      <link>https://community.qlik.com/t5/QlikView/Difference-by-Date-and-Product/m-p/1368390#M832723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to calculate the difference between dates and products.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here i attach you some data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="335"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" width="75"&gt;Date&lt;/TD&gt;&lt;TD width="64"&gt;Product&lt;/TD&gt;&lt;TD width="64"&gt;Value&lt;/TD&gt;&lt;TD width="132"&gt;Difference&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl63" height="20"&gt;05/05/2017&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;34&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl63" height="20"&gt;05/05/2017&lt;/TD&gt;&lt;TD align="right"&gt;2&lt;/TD&gt;&lt;TD align="right"&gt;23&lt;/TD&gt;&lt;TD align="right"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl63" height="20"&gt;06/05/2017&lt;/TD&gt;&lt;TD align="right"&gt;1&lt;/TD&gt;&lt;TD align="right"&gt;2&lt;/TD&gt;&lt;TD align="right"&gt;-32&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl63" height="20"&gt;06/05/2017&lt;/TD&gt;&lt;TD align="right"&gt;2&lt;/TD&gt;&lt;TD align="right"&gt;12&lt;/TD&gt;&lt;TD align="right"&gt;-11&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From what i have read, it can be done with the peek function, however i always see examples with one dimension.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;¿Could you help me?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Difference-by-Date-and-Product/m-p/1368390#M832723</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Difference by Date and Product</title>
      <link>https://community.qlik.com/t5/QlikView/Difference-by-Date-and-Product/m-p/1368391#M832724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need this in the script or on the front end of the application?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jun 2017 11:21:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Difference-by-Date-and-Product/m-p/1368391#M832724</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-06-14T11:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: Difference by Date and Product</title>
      <link>https://community.qlik.com/t5/QlikView/Difference-by-Date-and-Product/m-p/1368392#M832725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try below if you need to do this in script &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;temp:&lt;/P&gt;&lt;P&gt;load * inline [ &lt;/P&gt;&lt;P&gt;Date,Product,Value,Difference&lt;/P&gt;&lt;P&gt;05/05/2017,1,34,0&lt;/P&gt;&lt;P&gt;05/05/2017,2,23,0&lt;/P&gt;&lt;P&gt;06/05/2017,1,2,-32&lt;/P&gt;&lt;P&gt;06/05/2017,2,12,-11&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;NEW:&lt;/P&gt;&lt;P&gt;load Product,Date,Value,if(Product=Previous(Product),Value-Peek(Value),0) as Difference resident temp&lt;/P&gt;&lt;P&gt;order by Product,Date;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;drop table temp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jun 2017 11:32:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Difference-by-Date-and-Product/m-p/1368392#M832725</guid>
      <dc:creator>vinieme12</dc:creator>
      <dc:date>2017-06-14T11:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: Difference by Date and Product</title>
      <link>https://community.qlik.com/t5/QlikView/Difference-by-Date-and-Product/m-p/1368393#M832726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Vineeth it makes the job!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However i would like to understand how it is doing.&lt;/P&gt;&lt;P&gt;¿if instead of two dimensions there are 3? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have added an employee and the difference is not well calculated. ¿how can i make it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jun 2017 11:58:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Difference-by-Date-and-Product/m-p/1368393#M832726</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-06-14T11:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: Difference by Date and Product</title>
      <link>https://community.qlik.com/t5/QlikView/Difference-by-Date-and-Product/m-p/1368394#M832727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure what the output needs to look like, but try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;temp:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;load * inline [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Date,Product,Employee,Value&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;05/05/2017,1,1,34&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;05/05/2017,2,2,23&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;06/05/2017,1,1,2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;06/05/2017,2,3,12&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NoConcatenate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NEW:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;load Product,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Date,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Value,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Employee,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; if(Product=Previous(Product) and Employee = Previous(Employee), Value-Peek(Value),0) as Difference&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;resident temp&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;order by Product, Employee, Date;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;drop Tables temp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically Date should be the last sort for you and if you want to only subtract for the same Employee, then add that condition in your if statement as well as in the order by clause&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jun 2017 12:33:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Difference-by-Date-and-Product/m-p/1368394#M832727</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-06-14T12:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: Difference by Date and Product</title>
      <link>https://community.qlik.com/t5/QlikView/Difference-by-Date-and-Product/m-p/1368395#M832728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;¡thank you, now i understand it!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jun 2017 12:40:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Difference-by-Date-and-Product/m-p/1368395#M832728</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-06-14T12:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: Difference by Date and Product</title>
      <link>https://community.qlik.com/t5/QlikView/Difference-by-Date-and-Product/m-p/1368396#M832729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it´s not a big problem, i would like to know how can it be done the difference only applying it to the same year.&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;I am asking to know all the &lt;/SPAN&gt;possibilities about this function&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jun 2017 12:46:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Difference-by-Date-and-Product/m-p/1368396#M832729</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-06-14T12:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: Difference by Date and Product</title>
      <link>https://community.qlik.com/t5/QlikView/Difference-by-Date-and-Product/m-p/1368397#M832730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;temp:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;load * inline [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Year,Date,Product,Employee,Value&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2017,05/05/2017,1,1,34&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2017,05/05/2017,2,2,23&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2017,06/05/2017,1,1,2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2017,06/05/2017,2,2,27&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2017,06/05/2017,2,3,12&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2016,05/05/2016,1,1,34&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2016,05/05/2016,2,2,23&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2016,06/05/2016,1,1,2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2016,06/05/2016,2,2,27&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2016,06/05/2016,2,3,12&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NoConcatenate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NEW:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;load Product,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Date,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Year,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Value,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Employee,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; if(Product=Previous(Product) and Employee = Previous(Employee) and Year = Previous(Year), Value-Peek(Value),0) as Difference&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;resident temp&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;order by Product, Employee, Year, Date;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;drop Tables temp;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jun 2017 12:50:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Difference-by-Date-and-Product/m-p/1368397#M832730</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-06-14T12:50:24Z</dc:date>
    </item>
  </channel>
</rss>

