<?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 How to show NewSales bases on Date,Customer and Product? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-show-NewSales-bases-on-Date-Customer-and-Product/m-p/1386070#M422030</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have got a problem that i'm not able to solve. After days of research i hope you can help me! I don't now if it is possible, but I'm sure if there is a way you will find it.&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In our sales reporting I want to create a table that shows the "NewSales". A sale is a NewSale if a product has never been sold to a customer before (first occurance of customer AND product) . After the first sale of the product to this customer, all following sales of this product to the same customer are also NewSales for one year. Is the same product is sold to another customer, all sales are NewSales too for this customer. (for one year).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i assume, that the sales in the table below are all sales ever made. Than the green rows should show the NewSales.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="sales.jpg" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/174699_sales.jpg" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;For Example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Record 7 is a NewSale&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; because there is no record with Date &amp;lt;=31.03.&lt;STRONG&gt;2016&lt;/STRONG&gt; AND Customer = 2010076154 AND Product = C5303&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Record 8 is not a NewSale&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; because Record 1 is in the selection &amp;lt;=30.04.&lt;STRONG&gt;2016&lt;/STRONG&gt; AND Customer = 2010076154 AND Product = C5062&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had the ideas of implementing a flag for NewSales in the Load or build a table with all NewSales via indirect set analysis. But all my attemps failed. In a "normal" programming language i could probably solve this with a nested loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will attach the .qvw file with my test data. I hope you can help me!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Aug 2017 14:35:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-08-25T14:35:24Z</dc:date>
    <item>
      <title>How to show NewSales bases on Date,Customer and Product?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-show-NewSales-bases-on-Date-Customer-and-Product/m-p/1386070#M422030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have got a problem that i'm not able to solve. After days of research i hope you can help me! I don't now if it is possible, but I'm sure if there is a way you will find it.&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In our sales reporting I want to create a table that shows the "NewSales". A sale is a NewSale if a product has never been sold to a customer before (first occurance of customer AND product) . After the first sale of the product to this customer, all following sales of this product to the same customer are also NewSales for one year. Is the same product is sold to another customer, all sales are NewSales too for this customer. (for one year).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i assume, that the sales in the table below are all sales ever made. Than the green rows should show the NewSales.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="sales.jpg" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/174699_sales.jpg" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;For Example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Record 7 is a NewSale&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; because there is no record with Date &amp;lt;=31.03.&lt;STRONG&gt;2016&lt;/STRONG&gt; AND Customer = 2010076154 AND Product = C5303&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Record 8 is not a NewSale&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; because Record 1 is in the selection &amp;lt;=30.04.&lt;STRONG&gt;2016&lt;/STRONG&gt; AND Customer = 2010076154 AND Product = C5062&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had the ideas of implementing a flag for NewSales in the Load or build a table with all NewSales via indirect set analysis. But all my attemps failed. In a "normal" programming language i could probably solve this with a nested loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will attach the .qvw file with my test data. I hope you can help me!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Aug 2017 14:35:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-show-NewSales-bases-on-Date-Customer-and-Product/m-p/1386070#M422030</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-08-25T14:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to show NewSales bases on Date,Customer and Product?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-show-NewSales-bases-on-Date-Customer-and-Product/m-p/1386071#M422031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check the attached&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;rawdata:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD RowNo() as Record,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Date(MakeDate(Year, Month)) as Date,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;*;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; Month, Year, Customer, Salesman, Product, Sales&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01, 2012, 2010076154, Mueller, C5062, 6823.74&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 09, 2014, 2050348638, Mueller, 989, 45.1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 04, 2016, 2010076154, Mueller, C5303, 6823.74&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 04, 2016, 2050365821, Sommer, 991, 33&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01, 2017, 2050348638, Mueller, 985, 45.1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 02, 2017, 8170144016, Mueller, 135, 189&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 03, 2017, 2010076154, Sommer, C5303, 6823.74&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 04, 2017, 2010076154, Mueller, C5062, 6823.74&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 04, 2017, 2010076154, Mueller, C5303, 6823.74&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 04, 2017, 2050365821, Sommer, 991, 3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 05, 2017, 2050365821, Mueller, 989, 6&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 09, 2017, 2050348638, Mueller, 989, 45.1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 09, 2017, 2050348638, Mueller, 985, 45.1&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;sales:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD *,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If(Customer = Previous(Customer) and Product = Previous(Product), 1, 0) as Flag&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident rawdata&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Order By Customer, Product, Year, Month;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Left Join(sales)&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;Min(Date) as MinDate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident sales&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Where Flag = 0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Group By Product;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FinalSales:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD *,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If(Flag = 0 or MinDate &amp;gt; AddYears(Date, -1), 1, 0) as NewSales&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident sales;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP table rawdata, sales;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Aug 2017 15:55:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-show-NewSales-bases-on-Date-Customer-and-Product/m-p/1386071#M422031</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-08-25T15:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to show NewSales bases on Date,Customer and Product?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-show-NewSales-bases-on-Date-Customer-and-Product/m-p/1386072#M422032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Sunny!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You made my day!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just changed the join-part to&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Left Join(sales)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Customer&amp;amp;'-'&amp;amp;Product as $Key,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Min(Date) as MinDate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident sales&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Where Flag = 0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Group By Customer, Product;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Otherwise the MinDate would depend on the first occurance of the product only and not on the first occurance of cutomer AND product. This wasn't noticable with my original test data. I changed the test data and came to this adjustment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next week i will implement this to my application and I'm sure it will work fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot! &amp;amp; Greetings from Germany.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Aug 2017 08:22:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-show-NewSales-bases-on-Date-Customer-and-Product/m-p/1386072#M422032</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-08-26T08:22:57Z</dc:date>
    </item>
  </channel>
</rss>

