<?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 Calculate customer return rate in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Calculate-customer-return-rate/m-p/2106926#M90409</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to calculate the customers return rate by period, but I'm not sure what would be the best approach.&lt;/P&gt;
&lt;P&gt;Ideally, I wish to display in a line chart the % variance by month/year. I could do it combining Count and Aggr and aim for customers that the registry_date is lower than the purchase_date, then divide the total count by the total sales count. The problem is that I need to consider different time intervals (ex. &amp;lt;= 30 days, &amp;gt; 30 days and &amp;lt;= 45 days, &amp;gt; 45 days, etc.)&lt;/P&gt;
&lt;P&gt;First of all I'm trying to understand if it'd be better to create a dedicated field in the Loader or if I should use chart expressions...&lt;/P&gt;
&lt;P&gt;I actually built this in Excel using macros. First I added the sales records then I looped each existing customer_id&amp;nbsp; through the sales records and added every purchase date for each customer_id in ascending order (side by side). Then I looped through every date (from right to left) subtracting the previous date (which gave me the days difference between the two dates). For each subtraction I added +1 count to a Interval Table for the corresponding interval found and month. Finally I had a final table with counting for each interval which I used to built the line chart.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe I should do the same in Qlik? Or it'd be better to use expressions and/or set analysis?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help is appreciated!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a screenshot of the Excel solution and tables:&lt;/P&gt;
&lt;P&gt;[sales date by customer]&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="data compras.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/114669iB4587AD61737C8BA/image-size/large?v=v2&amp;amp;px=999" role="button" title="data compras.png" alt="data compras.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;[counting table by interval and month]&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tabela contagem.png" style="width: 842px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/114670i2D5227627311CD46/image-size/large?v=v2&amp;amp;px=999" role="button" title="tabela contagem.png" alt="tabela contagem.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;[final result]&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dash retorno.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/114671iC7C8656A044F823A/image-size/large?v=v2&amp;amp;px=999" role="button" title="dash retorno.png" alt="dash retorno.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS: Each line in the chart represents a different interval&lt;/P&gt;</description>
    <pubDate>Thu, 17 Aug 2023 22:29:52 GMT</pubDate>
    <dc:creator>pedrohenriqueperna</dc:creator>
    <dc:date>2023-08-17T22:29:52Z</dc:date>
    <item>
      <title>Calculate customer return rate</title>
      <link>https://community.qlik.com/t5/App-Development/Calculate-customer-return-rate/m-p/2106926#M90409</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to calculate the customers return rate by period, but I'm not sure what would be the best approach.&lt;/P&gt;
&lt;P&gt;Ideally, I wish to display in a line chart the % variance by month/year. I could do it combining Count and Aggr and aim for customers that the registry_date is lower than the purchase_date, then divide the total count by the total sales count. The problem is that I need to consider different time intervals (ex. &amp;lt;= 30 days, &amp;gt; 30 days and &amp;lt;= 45 days, &amp;gt; 45 days, etc.)&lt;/P&gt;
&lt;P&gt;First of all I'm trying to understand if it'd be better to create a dedicated field in the Loader or if I should use chart expressions...&lt;/P&gt;
&lt;P&gt;I actually built this in Excel using macros. First I added the sales records then I looped each existing customer_id&amp;nbsp; through the sales records and added every purchase date for each customer_id in ascending order (side by side). Then I looped through every date (from right to left) subtracting the previous date (which gave me the days difference between the two dates). For each subtraction I added +1 count to a Interval Table for the corresponding interval found and month. Finally I had a final table with counting for each interval which I used to built the line chart.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe I should do the same in Qlik? Or it'd be better to use expressions and/or set analysis?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help is appreciated!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a screenshot of the Excel solution and tables:&lt;/P&gt;
&lt;P&gt;[sales date by customer]&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="data compras.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/114669iB4587AD61737C8BA/image-size/large?v=v2&amp;amp;px=999" role="button" title="data compras.png" alt="data compras.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;[counting table by interval and month]&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tabela contagem.png" style="width: 842px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/114670i2D5227627311CD46/image-size/large?v=v2&amp;amp;px=999" role="button" title="tabela contagem.png" alt="tabela contagem.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;[final result]&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dash retorno.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/114671iC7C8656A044F823A/image-size/large?v=v2&amp;amp;px=999" role="button" title="dash retorno.png" alt="dash retorno.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS: Each line in the chart represents a different interval&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 22:29:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculate-customer-return-rate/m-p/2106926#M90409</guid>
      <dc:creator>pedrohenriqueperna</dc:creator>
      <dc:date>2023-08-17T22:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate customer return rate</title>
      <link>https://community.qlik.com/t5/App-Development/Calculate-customer-return-rate/m-p/2107200#M90425</link>
      <description>&lt;P&gt;Anyone? &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;I'm thinking maybe I should add a column to the sales fact table containing the days difference for each purchase. Maybe I could do that using a For loop using NoOfRows(SalesFact) and Previous(sale_date) to check for the previous date and find out the difference. I tried to follow this path, but I'm not sure how to order the table to be able to get the correct values, considering that I would have to order the table by customer_id, sale_id and sale_date...&lt;/P&gt;
&lt;P&gt;I'm supposing that if I have this additional column I could link the table to a bridge/intervalmatch table holding the different days interval by lowerbound and upperbound.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help is welcome... If anyone could shed a light on this I'd be very grateful!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2023 14:50:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Calculate-customer-return-rate/m-p/2107200#M90425</guid>
      <dc:creator>pedrohenriqueperna</dc:creator>
      <dc:date>2023-08-18T14:50:06Z</dc:date>
    </item>
  </channel>
</rss>

