<?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: Ratio Cumulative customer order by month in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2068052#M87602</link>
    <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/62662"&gt;@random_user_3869&lt;/a&gt;&amp;nbsp; is there specific reason to use loop?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 05 May 2023 09:16:07 GMT</pubDate>
    <dc:creator>Kushal_Chawda</dc:creator>
    <dc:date>2023-05-05T09:16:07Z</dc:date>
    <item>
      <title>Ratio Cumulative customer order by month</title>
      <link>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2066795#M87520</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;Here is the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table:&lt;BR /&gt;Load* Inline [&lt;/P&gt;
&lt;P&gt;YEarMonthNum, Customer_Num_Sales, Income&lt;BR /&gt;2022-05, 25E, 350€&lt;BR /&gt;2022-06,&amp;nbsp; 25E, 176€&lt;/P&gt;
&lt;P&gt;2022-07, 26F, 140€&lt;/P&gt;
&lt;P&gt;2022-08, 35E, 550€;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to create a script that can count the number of customer whose sales is superior to 150€.&lt;/P&gt;
&lt;P&gt;But i have an issue is regarding the following:&lt;/P&gt;
&lt;P&gt;in my examplen 2022-05 and 2022-06 the cusomer 25E is listed TWICE.&lt;/P&gt;
&lt;P&gt;I want to do it for cumulative month.&lt;/P&gt;
&lt;P&gt;So a new customer is a customer whose sales during the current period (may 2022) is superior to 150€ but in the last 12 months (not counting current months) the sales of this customer is zero.&lt;/P&gt;
&lt;P&gt;I struggle counting only a customer once because i don't want to add duplicate.&lt;/P&gt;
&lt;P&gt;Anyone can help ?&lt;/P&gt;
&lt;P&gt;THanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 14:36:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2066795#M87520</guid>
      <dc:creator>random_user_3869</dc:creator>
      <dc:date>2023-05-02T14:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Ratio Cumulative customer order by month</title>
      <link>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2066983#M87531</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/62662"&gt;@random_user_3869&lt;/a&gt;&amp;nbsp; Not sure if I understood it completely, but what does below give? Some more sample data with expected output will be more helpful.&amp;nbsp;Now you can use below expression&lt;/P&gt;
&lt;P&gt;=count ({&amp;lt;Customer_Num={"=sum(Sales)&amp;gt;150"}&amp;gt;} distinct Customer_Num)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 23:19:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2066983#M87531</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2023-05-02T23:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: Ratio Cumulative customer order by month</title>
      <link>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2068042#M87600</link>
      <description>&lt;P&gt;Sorry i need to explain more.&lt;/P&gt;
&lt;P&gt;Basically in qlik i have the following script that calculate for each period the number of customer where sales &amp;gt;150.&lt;/P&gt;
&lt;P&gt;But in my script i create a loop for each period but in the UI I need to display for exemple the number total of distinct cutomer for period 1 and 2.&lt;/P&gt;
&lt;P&gt;so let's say that a customer pays 200€ on period A and the same pays on period B. I want to count this customer only once which is on period A.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lessassy_3869_0-1683277319882.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/106530iF9C1E606BF6FDD13/image-size/medium?v=v2&amp;amp;px=400" role="button" title="lessassy_3869_0-1683277319882.png" alt="lessassy_3869_0-1683277319882.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the lines in red = sales inferior to 150 so we don't count&lt;/P&gt;
&lt;P&gt;So if i do a count distinct client on all the period (only the green) i get 4.&lt;/P&gt;
&lt;P&gt;But the customer 755 appear twice but we only want to count this client only once (at the first period it appear).&lt;/P&gt;
&lt;P&gt;So basically count customer = 3.&lt;/P&gt;
&lt;P&gt;That what i want to write in script&lt;/P&gt;
&lt;P&gt;SO here is my script in qlik&lt;/P&gt;
&lt;P&gt;$(vL.TableName):&lt;/P&gt;
&lt;P&gt;LOAD DISTINCT&lt;BR /&gt;[CUSTOMER NUMBER],&lt;BR /&gt;[SALES REVENUES],&lt;BR /&gt;[NEW CUSTOMERS],&lt;BR /&gt;'[Flag Periode],&lt;BR /&gt;SOCIETY_NUMBER&lt;/P&gt;
&lt;P&gt;Resident Table;&lt;/P&gt;
&lt;P&gt;FOr i = 1 to 23;&lt;BR /&gt;Let vL.PeriodeMoisNum = '$(i)'; ==&amp;gt; EQUALS MONTH NUM&lt;/P&gt;
&lt;P&gt;Trace Periode : $(vL.PeriodeMoisNum);&lt;BR /&gt;//N2&lt;BR /&gt;CONCATENATE($(vL.TableName))&lt;BR /&gt;LOAD DISTINCT&lt;BR /&gt;TRIM(TEXT(subfield(CUSTOMER_NUM,'-',2))) AS [CUSTOMER NUMBER],&lt;BR /&gt;SALES_REVENUES AS [SALES REVENUES],&lt;BR /&gt;NEW_CUSTOMER_COUNT AS [NEW CUSTOMERS],&lt;BR /&gt;'$(i)' AS [Flag Periode],&lt;BR /&gt;SOCIETY_NUMBER&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 09:04:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2068042#M87600</guid>
      <dc:creator>random_user_3869</dc:creator>
      <dc:date>2023-05-05T09:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: Ratio Cumulative customer order by month</title>
      <link>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2068043#M87601</link>
      <description>&lt;P&gt;Anyone has an insight ?&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 09:05:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2068043#M87601</guid>
      <dc:creator>random_user_3869</dc:creator>
      <dc:date>2023-05-05T09:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: Ratio Cumulative customer order by month</title>
      <link>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2068052#M87602</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/62662"&gt;@random_user_3869&lt;/a&gt;&amp;nbsp; is there specific reason to use loop?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 09:16:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2068052#M87602</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2023-05-05T09:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: Ratio Cumulative customer order by month</title>
      <link>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2068062#M87604</link>
      <description>&lt;P&gt;Yes because each period calculate the period where the sales is made.&lt;/P&gt;
&lt;P&gt;Let's say period = 0&lt;/P&gt;
&lt;P&gt;so sales revenu is calculated durring the current period. (we check the sales for the customer)&lt;/P&gt;
&lt;P&gt;And to say if it's a new client we check if no sales was made in the previous 12 month&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;period = 1&lt;/P&gt;
&lt;P&gt;so sales revenu is calculated durring the previous period (current period - 1). (we check the sales for the customer)&lt;/P&gt;
&lt;P&gt;And to say if it's a new client we check if no sales was made in the previous (12 month minus 1)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 09:25:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2068062#M87604</guid>
      <dc:creator>random_user_3869</dc:creator>
      <dc:date>2023-05-05T09:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: Ratio Cumulative customer order by month</title>
      <link>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2068066#M87606</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/62662"&gt;@random_user_3869&lt;/a&gt;&amp;nbsp; after loop. you can have additional load to create flag to see sales &amp;gt;150.&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Final:
LOAD *,
     if(SALES&amp;gt;150,1,0) as Flag_sales
resident $(vL.TableName);

drop table $(vL.TableName);

Now, you can use this flag in measure
=count({&amp;lt;Flag_sales={1}&amp;gt;}distinct Customer)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 09:34:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2068066#M87606</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2023-05-05T09:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Ratio Cumulative customer order by month</title>
      <link>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2068222#M87611</link>
      <description>&lt;P&gt;Thanks but with my script (not shown here) i already filter the sutomer whose sale &amp;gt;150.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lessassy_3869_0-1683294452913.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/106560iFE2ED63B51D19CBC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="lessassy_3869_0-1683294452913.png" alt="lessassy_3869_0-1683294452913.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;In my script (not shown) i wrote a case and the output value string is 'new'&amp;nbsp; AS NUMBER_OF_CUSTOMER&lt;/P&gt;
&lt;P&gt;Then in my set analysis i do something like: Count({&amp;lt;Period = {'1','2'}&amp;gt;}NUMBER_OF_CUSTOMER)&lt;/P&gt;
&lt;P&gt;By doing that i count twice the customer 755 for example.&lt;/P&gt;
&lt;P&gt;ANd i don't want that&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 14:00:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2068222#M87611</guid>
      <dc:creator>random_user_3869</dc:creator>
      <dc:date>2023-05-05T14:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: Ratio Cumulative customer order by month</title>
      <link>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2068344#M87623</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/62662"&gt;@random_user_3869&lt;/a&gt;&amp;nbsp; Would you be able to provide sample qvf or qvw file to look at? It will be difficult to answer without looking at data and data model&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 20:05:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2068344#M87623</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2023-05-05T20:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: Ratio Cumulative customer order by month</title>
      <link>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2068379#M87628</link>
      <description>&lt;P&gt;Try something like this&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table:&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; *,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; YearMonth(Date#(YEarMonthNum, 'YYYY-MM')) AS YearMonth&lt;/P&gt;
&lt;P&gt;INLINE [&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; YEarMonthNum, Customer_Num_Sales, Income&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; 2022-05, 25E, 350€&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; 2022-06, 25E, 176€&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; 2022-07, 26F, 140€&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; 2022-08, 35E, 550€&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FilteredTable:&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Customer_Num_Sales,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; YearMonth&lt;/P&gt;
&lt;P&gt;WHERE&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Income &amp;gt; 150&lt;/P&gt;
&lt;P&gt;GROUP BY&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Customer_Num_Sales,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; YearMonth;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FinalTable:&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Customer_Num_Sales&lt;/P&gt;
&lt;P&gt;RESIDENT FilteredTable&lt;/P&gt;
&lt;P&gt;WHERE&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; NOT EXISTS(Customer_Num_Sales, YearMonth - 1, 'FilteredTable');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Count(DISTINCT Customer_Num_Sales) AS NumberOfCustomers&lt;/P&gt;
&lt;P&gt;RESIDENT FinalTable;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DROP&lt;/P&gt;
&lt;P&gt;TABLES FilteredTable, FinalTable;&lt;/P&gt;</description>
      <pubDate>Sat, 06 May 2023 07:01:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2068379#M87628</guid>
      <dc:creator>Chanty4u</dc:creator>
      <dc:date>2023-05-06T07:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: Ratio Cumulative customer order by month</title>
      <link>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2070288#M87777</link>
      <description>&lt;P&gt;I'll check this this weekend !&lt;/P&gt;
&lt;P&gt;THank you&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 15:29:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Ratio-Cumulative-customer-order-by-month/m-p/2070288#M87777</guid>
      <dc:creator>random_user_3869</dc:creator>
      <dc:date>2023-05-11T15:29:48Z</dc:date>
    </item>
  </channel>
</rss>

