<?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: Create Column with previous sales value for same dimension in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Create-Column-with-previous-sales-value-for-same-dimension/m-p/1753414#M591252</link>
    <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/127818"&gt;@othonperrone&lt;/a&gt;&amp;nbsp; in case you want to do it at script level :&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Data:

LOAD  *  INLINE [
    Order, Product, Value, Date
    1, A,30, 03/06/2020
    2, B,40, 20/06/2020
    3, B,50, 13/09/2020
    4, C,60, 09/05/2020
    5, C,65, 06/09/2020
    6, C,35, 01/06/2020
    7, A,43, 14/01/2020
    8, B,23, 15/12/2020
    9, B,45, 25/06/2020
];

Output:
noconcatenate

Load *,if(peek(Product)=Product,peek(Value)) as [Previous Value for Product];
load * resident Data Order By Product ASC, Date ASC ;

drop table Data;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 537px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/42512iA02C843378858B5D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I think befor order 5 its 6!&lt;/P&gt;</description>
    <pubDate>Sat, 17 Oct 2020 08:47:56 GMT</pubDate>
    <dc:creator>Taoufiq_Zarra</dc:creator>
    <dc:date>2020-10-17T08:47:56Z</dc:date>
    <item>
      <title>Create Column with previous sales value for same dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Column-with-previous-sales-value-for-same-dimension/m-p/1753382#M591250</link>
      <description>&lt;P&gt;Hi Guys, I am new to Qlik sense and I need a help to solve this issue:&lt;BR /&gt;&lt;BR /&gt;I need to retrieve previous data from same dimension ,&lt;/P&gt;&lt;P&gt;For example, for &lt;STRONG&gt;order "1"&lt;/STRONG&gt;&amp;nbsp; I need to check what was the previous sales date for product A before 03/06/2020 (dd/mm/yy format) and bring the value for that order, in this example it was &lt;STRONG&gt;order 7&lt;/STRONG&gt;&amp;nbsp;that occurred in 14/01 with a R$43 value.&lt;BR /&gt;I need this previous value for each line.&lt;BR /&gt;&lt;BR /&gt;Table1:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Order&lt;/TD&gt;&lt;TD&gt;Product&lt;/TD&gt;&lt;TD&gt;Value&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Previous Value for Product&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;R$30,00&lt;/TD&gt;&lt;TD&gt;03/06/2020&lt;/TD&gt;&lt;TD&gt;R$43,00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;R$40,00&lt;/TD&gt;&lt;TD&gt;20/06/2020&lt;/TD&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;R$50,00&lt;/TD&gt;&lt;TD&gt;13/09/2020&lt;/TD&gt;&lt;TD&gt;R$45,00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;R$60,00&lt;/TD&gt;&lt;TD&gt;09/05/2020&lt;/TD&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;R$65,00&lt;/TD&gt;&lt;TD&gt;06/09/2020&lt;/TD&gt;&lt;TD&gt;R$60,00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;R$35,00&lt;/TD&gt;&lt;TD&gt;01/06/2020&lt;/TD&gt;&lt;TD&gt;R$60,00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;R$43,00&lt;/TD&gt;&lt;TD&gt;14/01/2020&lt;/TD&gt;&lt;TD&gt;-&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;R$23,00&lt;/TD&gt;&lt;TD&gt;15/12/2020&lt;/TD&gt;&lt;TD&gt;R$50,00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;R$45,00&lt;/TD&gt;&lt;TD&gt;25/06/2020&lt;/TD&gt;&lt;TD&gt;R$40,00&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Thankyou in advance&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2020 23:17:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Column-with-previous-sales-value-for-same-dimension/m-p/1753382#M591250</guid>
      <dc:creator>othonperrone</dc:creator>
      <dc:date>2020-10-16T23:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Create Column with previous sales value for same dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Column-with-previous-sales-value-for-same-dimension/m-p/1753397#M591251</link>
      <description>&lt;P&gt;here is a simple suggestion with caveats:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="edwin_0-1602902861523.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/42506iF8548CF743B9CB9A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="edwin_0-1602902861523.png" alt="edwin_0-1602902861523.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the straight chart needs to be sorted by Product then date&lt;/P&gt;</description>
      <pubDate>Sat, 17 Oct 2020 02:48:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Column-with-previous-sales-value-for-same-dimension/m-p/1753397#M591251</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2020-10-17T02:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: Create Column with previous sales value for same dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Column-with-previous-sales-value-for-same-dimension/m-p/1753414#M591252</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/127818"&gt;@othonperrone&lt;/a&gt;&amp;nbsp; in case you want to do it at script level :&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Data:

LOAD  *  INLINE [
    Order, Product, Value, Date
    1, A,30, 03/06/2020
    2, B,40, 20/06/2020
    3, B,50, 13/09/2020
    4, C,60, 09/05/2020
    5, C,65, 06/09/2020
    6, C,35, 01/06/2020
    7, A,43, 14/01/2020
    8, B,23, 15/12/2020
    9, B,45, 25/06/2020
];

Output:
noconcatenate

Load *,if(peek(Product)=Product,peek(Value)) as [Previous Value for Product];
load * resident Data Order By Product ASC, Date ASC ;

drop table Data;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 537px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/42512iA02C843378858B5D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I think befor order 5 its 6!&lt;/P&gt;</description>
      <pubDate>Sat, 17 Oct 2020 08:47:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Column-with-previous-sales-value-for-same-dimension/m-p/1753414#M591252</guid>
      <dc:creator>Taoufiq_Zarra</dc:creator>
      <dc:date>2020-10-17T08:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: Create Column with previous sales value for same dimension</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Column-with-previous-sales-value-for-same-dimension/m-p/1753532#M591253</link>
      <description>&lt;P&gt;That's it!! thank you&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/56648"&gt;@Taoufiq_Zarra&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Oct 2020 22:30:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Column-with-previous-sales-value-for-same-dimension/m-p/1753532#M591253</guid>
      <dc:creator>othonperrone</dc:creator>
      <dc:date>2020-10-18T22:30:15Z</dc:date>
    </item>
  </channel>
</rss>

